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:
parent
3ed64ceb54
commit
7ee377352e
2 changed files with 24 additions and 22 deletions
|
@ -3,11 +3,7 @@ var markers;
|
||||||
var popup;
|
var popup;
|
||||||
|
|
||||||
function createMap(divName) {
|
function createMap(divName) {
|
||||||
map = new OpenLayers.Map(divName,
|
map = new OpenLayers.Map(divName);
|
||||||
{ maxExtent: new OpenLayers.Bounds(-20037508,-20037508,20037508,20037508),
|
|
||||||
maxResolution: 156543,
|
|
||||||
units: 'm',
|
|
||||||
projection: "EPSG:41001" });
|
|
||||||
|
|
||||||
var mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik", { displayOutsideMaxExtent: true });
|
var mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik", { displayOutsideMaxExtent: true });
|
||||||
map.addLayer(mapnik);
|
map.addLayer(mapnik);
|
||||||
|
|
|
@ -44,7 +44,13 @@ OpenLayers.Layer.OSM = OpenLayers.Class(OpenLayers.Layer.TMS, {
|
||||||
* options - {Object} Hashtable of extra options to tag onto the layer
|
* options - {Object} Hashtable of extra options to tag onto the layer
|
||||||
*/
|
*/
|
||||||
initialize: function(name, url, options) {
|
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);
|
OpenLayers.Layer.TMS.prototype.initialize.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue