I'm trying to overlay a WMS layer over GoogleMaps base one. The WMS layer is defined like this:

 var catastro_layer = new OpenLayers.Layer.WMS(
           "WMS Catastro",
                   layers: "catastro",
                   srs: "EPSG:3785",
                   transparent: false

GoogleMaps layers are defined just like here http://openlayers.org/blog/2010/07/10/google-maps-v3-for-openlayers/.

As result, my WMS layer appears as one base layer more. So, I can select it instead of the other base layers, not over them. This screenshots shows what I mean: http://dl.dropbox.com/u/6599273/capa_wms1.png

The WMS requests are ok:


But this isn't what I need. I want a GoogleMaps base layer and a transparent WMS overlay.

Now, if I change the WMS layer defintion replacing transparent: false by transparent: true:

 var catastro_layer = new OpenLayers.Layer.WMS(
           "WMS Catastro",
                   layers: "catastro",
                   srs: "EPSG:3785",
                   transparent: true

My WMS layer appears as a overlay: http://dl.dropbox.com/u/6599273/capa_wms2.png, just what I want.

But now, the requests are incorrect:


As you can see, the epsg:3785 has been replaced by epsg:900913. But the only change I've made is "transparent: false" by "transparent: true". Why is this happening?

Many thanks in advance, and best regards

3 Answers 3


In OpenLayers, the base layer dictates what is going to be the "base spatial reference". So any overlay will be projected to the base srid. Since any base layer that comes from the consumer-based providers (google, bing, yahoo, etc) supports only 900913, then OpenLayers is doing the right thing for your.

If you do a GetCapabilities call on your server you will notice the following section:

<Layer queryable="1" opaque="0" noSubsets="0">
<LegendURL width="160" height="500">
<OnlineResource xlink:type="simple" xlink:href="http://ovc.catastro.meh.es/Cartografia/WMS/simbolos.png"/>
<BoundingBox SRS="EPSG:4230" minx="-18.409876" miny="26.275447" maxx="5.22598" maxy="44.85536"/>
<BoundingBox SRS="EPSG:4326" minx="-18.409876" miny="26.275447" maxx="5.22598" maxy="44.85536"/>
<BoundingBox SRS="EPSG:4258" minx="-18.409876" miny="26.275447" maxx="5.22598" maxy="44.85536"/>
<BoundingBox SRS="EPSG:32627" minx="770000" miny="3000000" maxx="2700000" maxy="5000000"/>
<BoundingBox SRS="EPSG:32628" minx="180000" miny="3000000" maxx="2170000" maxy="5000000"/>
<BoundingBox SRS="EPSG:23029" minx="-410000" miny="3000000" maxx="1650000" maxy="5000000"/>
<BoundingBox SRS="EPSG:23030" minx="-1050000" miny="3000000" maxx="1150000" maxy="5000000"/>
<BoundingBox SRS="EPSG:23031" minx="-1615000" miny="3000000" maxx="620000" maxy="5000000"/>
<BoundingBox SRS="EPSG:32629" minx="-410000" miny="3000000" maxx="1650000" maxy="5000000"/>
<BoundingBox SRS="EPSG:32630" minx="-1050000" miny="3000000" maxx="1150000" maxy="5000000"/>
<BoundingBox SRS="EPSG:32631" minx="-1615000" miny="3000000" maxx="620000" maxy="5000000"/>
<BoundingBox SRS="EPSG:25829" minx="-410000" miny="3000000" maxx="1650000" maxy="5000000"/>
<BoundingBox SRS="EPSG:25830" minx="-1050000" miny="3000000" maxx="1150000" maxy="5000000"/>
<BoundingBox SRS="EPSG:25831" minx="-1615000" miny="3000000" maxx="620000" maxy="5000000"/>
<BoundingBox SRS="EPSG:3785" minx="-2100000" miny="3000000" maxx="500000" maxy="5600000"/>

Lo and behold, 900913 is not an option. You may need to either:

  • modify the WMS server definition to make sure that 900913 is allowed as a valid reprojection
  • add a definition for that new srid (depends on what web server you are using)
  • a combination of thse

By looking at the URL, it seems you are using an ASP .NET WMS server, since Geoserver is java and Mapserver if cgi, and ArcGIS Server is .NET, I am going guess this is an ESRI server, so the instructions on how to modify this is here.

Update: As mkennedy points out, the official EPSG code for SphericalMercator (aka Google's projection) is 3857 and a previous assigned number was 3785. If you are wondering why there are so many numbers that refer to the same spatial reference, crschmidt's blog post will give you a clue...

Ian pointed out the relevant OpenLayer's documentation section to force OpenLayers to use that EPSG code instead.

Since your GetCapabilities section shows 3785, the code from the OL documentation won't work as is, you will need to replace all the 3857 for 3785.

  • Upvoted, since this one had more information, but the key component is in the update; you need to do what the OL docs say. Jun 11, 2011 at 19:18

That request is correct - Google uses a spherical mercator projection (epsg:900913) so if you request your WMS layer in 3785 it won't line up with your Google base map. If your server is unable to reproject the data (as appears to be the case) you can set up a cascading WMS (both GeoServer and MapServer can do this) to fetch the WMS layer in 3785 and reproject it to 900913 for you.


if a layer is not a base layer then you need to add

'isBaseLayer': false

in its definition

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.