[OpenLayers-Users] SphericalMercator and SRS aliases epsg:900913, epsg:3857, epsg:3785, epsg:102113

Anne Blankert anne.blankert at geodan.nl
Sun Jul 25 07:53:55 EDT 2010


Hmm, 

I didn't test my code properly, (layers without option sphericalmercator
stopped working). The following code should do better (Version >= 1.3 not
yet tested):

// override OpenLayers.WMS.getFullRequestString class member function
OpenLayers.Layer.WMS.prototype.getFullRequestString = function(newParams,
altUrl) { 
	var projectionCode = this.map.getProjection();
	var value = (projectionCode == "none") ? null : projectionCode
	if (this.options.sphericalmercatoralias)
	{
		if(value == 'EPSG:900913' || value == 'EPSG:102113' || value ==
'EPSG:3857') { 
			value = this.options.sphericalmercatoralias; 
		} 
	} 
	if (parseFloat(this.params.VERSION) >= 1.3) {
		this.params.CRS = value;
	} else {
		this.params.SRS = value;
	}

	return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(this,
arguments);
}


After this override, you can set a new layeroption 'sphericalmercatoralias'
to tell OpenLayers to use that instead of the default as follows: 

layer = new OpenLayers.Layer.WMS(title, url, {layers: layernames},
{sphericalmercatoralias: "EPSG:102113"}); 

-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/SphericalMercator-and-SRS-aliases-epsg-900913-epsg-3857-epsg-3785-epsg-102113-tp5311417p5334827.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list