Move scale/resolution configuration to the base layers so that

people dragging in our customer layers don't need to worry about
setting the magic numbers.
This commit is contained in:
Tom Hughes 2007-12-06 14:18:30 +00:00
parent 3ed64ceb54
commit 7ee377352e
2 changed files with 24 additions and 22 deletions

View file

@ -3,11 +3,7 @@ var markers;
var popup;
function createMap(divName) {
map = new OpenLayers.Map(divName,
{ maxExtent: new OpenLayers.Bounds(-20037508,-20037508,20037508,20037508),
maxResolution: 156543,
units: 'm',
projection: "EPSG:41001" });
map = new OpenLayers.Map(divName);
var mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik", { displayOutsideMaxExtent: true });
map.addLayer(mapnik);

View file

@ -44,7 +44,13 @@ OpenLayers.Layer.OSM = OpenLayers.Class(OpenLayers.Layer.TMS, {
* options - {Object} Hashtable of extra options to tag onto the layer
*/
initialize: function(name, url, options) {
options = OpenLayers.Util.extend(options, { attribution: "Data by <a href='http://openstreetmap.org/'>OpenStreetMap</a>" });
options = OpenLayers.Util.extend(options, {
attribution: "Data by <a href='http://openstreetmap.org/'>OpenStreetMap</a>",
maxExtent: new OpenLayers.Bounds(-20037508,-20037508,20037508,20037508),
maxResolution: 156543,
units: "m",
projection: "EPSG:41001"
});
OpenLayers.Layer.TMS.prototype.initialize.apply(this, arguments);
},