1

I am trying to connect to my Google Maps Engine Map using WMS in my leaflet application. I am able to connect just fine with ArcMap.

enter image description here

enter image description here

However when using leaflet, I get 'no data for requested layers'. Here is a jsfiddle.

// create a map
map = new L.Map('mymap');

// set the map's starting view
map.setView( new L.LatLng(22,79), 4 );

L.tileLayer.wms("https://mapsengine.google.com/15658084116283052074-10602818151822182906-4/wms/", {
  layers: 'x',
  format: 'image/png',
  version: '1.1.0',
  transparent: true,
  attribution: "",
  tiled:true
}).addTo(map);

Do I have the wrong settings/layer?

Edit: GetCapabilities returns...

<Layer queryable="0">
    <Name>15658084116283052074-10602818151822182906-4</Name>
    <Title>x</Title>
    <Abstract/>
    <CRS>EPSG:3857</CRS>
    <CRS>EPSG:3785</CRS>
    <CRS>EPSG:900913</CRS>
    <Layer queryable="0">
        <Name>15658084116283052074-00933023778830223306-4</Name>
        <Title>x</Title>
        <Abstract>Raster layer</Abstract>
        <CRS>EPSG:4326</CRS>
        <EX_GeographicBoundingBox>
          <westBoundLongitude>-100.00045742818516</westBoundLongitude>
          <eastBoundLongitude>-92.99988641904172</eastBoundLongitude>
          <southBoundLatitude>39.99928465598993</southBoundLatitude>
          <northBoundLatitude>47.00075398041749</northBoundLatitude>
        </EX_GeographicBoundingBox>
    </Layer>
</Layer>
2

This worked...

L.tileLayer.wms("https://mapsengine.google.com/15658084116283052074-10602818151822182906-4/wms/", {
        layers: '15658084116283052074-00933023778830223306-4,15658084116283052074-00933023778830223306-4',
      format: 'image/png',
      version: '1.3.0',
      transparent: true,
      attribution: "",
    }).addTo(map);
0

For anyone else who comes through here researching this, it seems Google Maps Engine (GME) doesn't expose individual layers as WMS assets. If I'm wrong, I hope someone will correct me in the comments.

Rather, you have to create and publish a map asset to include the layer(s) you want, then publish the map. Then, the map's "access links" will include a WMS url. To find it, browse into your map in the GME dashboard, look in the upper right corner of the map details view, click on "access links" and note the WMS option. The map will need to be published as "public on the web" rather than for specific users.

..I'm not sure why @JustinPoehnelt cited the same layer twice in the layers property, though? Perhaps he'll see this and remark on that.

Here are the steps, visually.

Login to your GME dashboard, then 1) toggle your "Maps" navigation and 2) select an existing/published map asset.

enter image description here

Next, 3) select "Access links", and 4) toggle the "OGC" tab.

FYI you only need to copy up to /wms/; you don't need the ?version=1.3.0 parameter.

enter image description here

Finally, 5) double-check "Published version sharing". You may need to alter the "Published version sharing" value to "Public on the web". Don't quote me, but I'm like 97.41096% sure about this.

enter image description here

Then, in my Leaflet/JavaScript--and similar to the above answer--I've got something like this. The -4 denotes a publicly-published map/layer, and apparently, -2 denotes a preview version.

var gmeWMS = L.tileLayer.wms("https://mapsengine.google.com/xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-4/wms/", {
/* layers is set to the same value as the xx'd out value in the URL above */
    layers: 'xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-4',
    format: 'image/png',
    version: '1.3.0',
    transparent: true,
    attribution: "",
}).addTo(map);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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