If sphericalMercator, use default values from Projection.defaults

This commit is contained in:
fredj
2012-02-15 12:30:05 +01:00
parent 11966d231f
commit a40ae7ef11

View File

@@ -70,19 +70,10 @@ OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, {
* options - {Object} Hashtable of extra options to tag onto the layer
*/
initialize: function(name, url, options) {
if (options && options.sphericalMercator || this.sphericalMercator) {
options = OpenLayers.Util.extend({
maxExtent: new OpenLayers.Bounds(
-128 * 156543.03390625,
-128 * 156543.03390625,
128 * 156543.03390625,
128 * 156543.03390625
),
maxResolution: 156543.03390625,
numZoomLevels: 19,
units: "m",
projection: "EPSG:900913"
}, options);
options = options || {};
if (options.sphericalMercator || this.sphericalMercator) {
options.projection = new OpenLayers.Projection('EPSG:900913');
options.numZoomLevels = 19;
}
url = url || this.url;
name = name || this.name;