Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#2631 closed bug (invalid)

WMS layer always sends "EPSG:900913" if Google is the baselayer and "sphericalMercator" is set to "true"

Reported by: august Owned by: euzuro
Priority: minor Milestone: 2.10 Release
Component: Layer.WMS Version: 2.9
Keywords: SRS, CRS Cc: anakintang@…


When you use Google as baselayer and set "sphericalMercator" to "true", the map's projection somehow sticks to EPSG:900913. So if you now have a WMS overlay, the GetMap request will always be sent with "SRS=EPSG:900913". In this case it's not possible to overlay a WMS which doesn't use "EPSG:900913" for sphericaMercator projection

Change History (5)

comment:1 Changed 7 years ago by elemoine

  • Resolution set to invalid
  • Status changed from new to closed

The map projection is the default projection of WMS layers. If you want a specific projection for a WMS layer set the "srs" in the WMS layer parameters.

comment:2 Changed 7 years ago by august

Right, WMS layer srs should overwrite map's srs. But here is the code that reproduces the problem:

function initEpsg102113() {

var lon = -122.6335; var lat = 45.4447;

var center_mercator = OpenLayers.Layer.SphericalMercator.forwardMercator(lon, lat); center_mercator_x = center_mercator.lon; center_mercator_y =;

var zoom = 3;

clear array to simulate a wrong axis order request

var options = {

projection: "EPSG:102113", units: "m",

maxResolution: 156543.0339,

maxExtent: new OpenLayers.Bounds(-20037508.3392, -20037508.3392, 20037508.3392, 20037508.3392),


map = new OpenLayers.Map('map', options); var gmap = new OpenLayers.Layer.Google(

"Google Streets", the default {

numZoomLevels: 20, sphericalMercator: true, isBaseLayer: true,


); var layer = new OpenLayers.Layer.WMS(

"GeoWebcache WMS service", "http://sazabi:8080/geowebcache-1.2.2/service/wms?", {

layers: 'arcgis-online-wms', version: '1.1.1', srs: 'epsg:102113', transparent: true

}, {

singleTile: false, isBaseLayer: false


); map.addLayers([gmap,layer]); map.setCenter(new OpenLayers.LonLat(center_mercator_x, center_mercator_y), zoom);


I even set map's projection to something other than "EPSG:900913", but I still it 900913 being sent out to WMS. Is there anything I did wrong in the code?


comment:3 Changed 7 years ago by ahocevar

  • State Needs Discussion deleted

Your Google layer is the base layer. The WMS layer is an overlay. Base layers determine the projection of the map. WMS layers cannot be reprojected in OpenLayers. So what you see is expected behavior. Remove {{{isBaseLayer: false}} on the WMS layer, and it will become a base layer (and not overlay on the Google layer any more), but be requested in your desired projection.

comment:4 Changed 7 years ago by crschmidt

I think that august is trying to use a code other than 900913, but has the same meaning. This is not possible with our current setup.

august, if you want to do this, you can change the projection of the layer after you create it, but before you add it to the map:

  var l = new OpenLayers.Layer.Google("g", {sphericalMercator: true});
  l.projection = "EPSG:100135";

The current design is intended (but possibly not ideal). A ticket to change this might be something like "It should be possible to override the SRS string for an overly WMS layer, to support WMS services which use non-standard/different EPSG codes which have the same meaning as the base layer."

comment:5 Changed 7 years ago by august

Hi crschmidt,

That is exactly what I meant, and thanks for clarifying it. The use case is like ArcGIS Server WMS is not recognizing EPSG:900913, but instead, it may use EPSG:102113, EPSG:3785 in which the result map can be overlay on Google base layer.

Thanks a lot!

Note: See TracTickets for help on using tickets.