Skip to content Skip to sidebar Skip to footer

Wms Published From Google Maps Engine Not Displaying

I am new to JS and Google Maps API...I acquired some JS code to hopefully display a WMS that I created in Google Maps Engine. I have got stuck with the below code as the WMS seems

Solution 1:

You've got 2 problems with your code. The first is obvious. You're using your map ID as your layer ID. They're two separate things. In GME, go in to the layer detail screen and click "Access Links" and pick up the layer ID. It'll start with 17306057122701807517- but the second half will be different. Also, don't forget to append -4 to the end. This indicates it's a published layer as opposed to one in preview. Tip: If you make it -2 you can see the preview version e.g. the updated but unpublished one.

Now for your second problem which is way more subtle. The EPSG code used in the above example is 4326 which is WGS84 while Google Maps are published in Google Web Mercator which is EPSG:900913. You can't just swap out the EPSG code as the coordinate system used is different. This really means that unless you rewrite the code to generate the bounding box then you can't use that javascript.

What I'd recommend is using the code from http://www.sigacts.com/html5/google-maps-api-with-wms-overlay/ which uses the correct coordinate system. The example actually uses a MapsEngine map as well. Just download the code and modify vars.js to suit and you're away. I've downloaded and validated that it works with my own map as well so you should have no problems. Hint: The code is a little old and references earthbuilder.google.com which is the old name for MapsEngine. Make sure you change both the domain name and the Map ID.

EDIT: WMS is a clunky way of getting content on to the Map. You should be looking to use MapsEngineLayer which is part of the Google Maps API or for more fine-grained things you can use the Maps Engine API which allows you to do attribute filtering, spatial queries etc.

Post a Comment for "Wms Published From Google Maps Engine Not Displaying"