Wednesday, 29 March 2006

Issues with Google Maps and Web Map Server (WMS) Mashups



I've been integrating a Google Map layer into Community Mapbuilder - a web mapping client so that we can display Web Map Server (WMS) layers over a GoogleMap base.
However, we have run into problems with Spacial Reference Systems (or projection). A projection is a way to describe a spherical world on a flat piece of paper.
The WMS specification (as defined by the Open Geospacial Consortium) defines thousands of different Spacial Reference Systems using EPSG codes. For example, simple (lat,long) uses EPSG:4326. And a WMS request looks something like:

http://www2.demis.nl/WMS/wms.asp?wms=WorldMap&wmtver=1.0.0&request=map&layers=Builtup+areas,Railroads,Highways,Roads,Trails,Borders,Cities,Settlements,Airports&srs=EPSG:4326&bbox=-160.14,-3.37,-19.69,55.23&width=800&height=400&format=image/gif&styles=default&transparent=true&uniqued=

Unfortunately, the Mercator projection & datum used by Google Maps does not have a corresponding EPSG code.
Consequently, as far as I can work out, it is not possible to use a standard way to request a WMS map which is in the same projection as Google Maps.
Existing WMS/Google Map mashups I've seen on the web so far use EPSG:4326. This projection is reasonably close if you zoom into a city, but is out by miles if you look at a map of the world. (See images).
Recommendation
  1. Google, the OGC, and the owners of EPSG codes should get together and define a new EPSG code so these two types of maps can be incorporated together.
  2. I'm guessing option 1 will take a while. So in the mean time, WMS servers and WMS clients (like Mapbuilder) should define our own EPSG code to use in the interum. Maybe EPSG:Mercator?
Disclaimer
I'm a programmer, not a geographer, so I'm likely to have some of the geographic terms incorrect.
Update 30 Sept 2006
John Deck has blogged describing a work around to rendering WMS on Google Maps at
http://johndeck.blogspot.com/2005/09/overlaying-mercator-projected-wms.html and then an update at http://johndeck.blogspot.com/2006_02_01_johndeck_archive.html.
Open Layers have incorporated a hack into their codebase which includes stretching the WMS layer to fit. This will still have distortion issues as the projection of the WMS and Google Map use different projections.
The best solution would still be if a new EPSG code were created for GoogleMap layers.

1 comment:

Cameron Shorter said...

Since writing this blog, a new EPSG code has been developed which supports the Google projection, and this is incorporated into good WMS services like Geoserver. Use EPSG:900913 (look closely at the numbers and you should see EPSG:900913 = EPSG:g00glE = EPSG:google)