Friday, January 27, 2006

Layering WMS services using GoogleMaps API V2


NOTE: I changed this posting substantially on February 1st as the previous code did not work when using GPolyline methods. This code now works with polylines.

Here is my method for creating GoogleMaps API V2 WMS Layers. In version 1, I started with code developed by Brian Flood and Kyle Mulka and ended up re-writing most of that class for V2 using code and examples from Mike Williams. The dd2Mercator conversion bits can be left off if dealing with small scale maps only.

Click here for a working example of this code. NOTE: On June 9th, i deleted the code references in this blog and instead refer people to view the source of the working example linked to above.

6 comments:

Anonymous said...

Amazing! Thank you for sharing this example--very helpful.--Mike Quentel

Unknown said...

Hi , I'm actually working on a mapbuilder project and I would like to know what is the main difference between the 41001 projection and 54004 projection ?
We are using a mercator function from the gctpc library and there is no "standard parallel 1 " field for the mercator projection ...
If I want to use a 54004, can I use a 41001 instead ?
If no , can you explain me how to add the 54004 projection in the proj.js ?
Thanx
Yacine.fantoussi@gmail.com

John Deck said...

54004 and 41001 should be the same. I came up with 54004 when I could not find any other Mercator definitions on the EPSG list. Later it turned out that 41001 is a more logical number.

Unknown said...

Hello, I have started working with WMS and Google Map. And I have a doubt : my WMS data is EPSG: 4326 and I want to overlay them on Google maps, is possible to utilize the GMaps_WMSSpec_0.1.js this transform data in 4326 to 54004? is this correct?. Thank you.

aitzama@yahoo.es

Anonymous said...

fiona,
4326 should work ok if you are zoomed way in..(closer than county level). If you need to look at larger areas, i would look at other posts in this blog and elsewhere about using the mercator projection.

Unknown said...

Hi, thank you. In my case I need this for look at state level of one country, maybe to bigger scale than this but not smaller.

So this GMaps_WMSSpec_0.1.js transform your data from WGS84 to Mercartor Projection?

Thank you, I will try it.