jiraiya
jiraiya

Reputation: 997

ESRI Leafet ImageryLabels BasemapLayer not displaying - all tile widths set to 0

I have been debuggging a very unusual issue with ESRI's ImageryLabels basemap but as of yet I have been unable to ascertain the root cause of the issue. I was wondering if anyone had a similar issue.

I want to display the Imagery basemap with both ImageryTransportation and also the ImageryLabels layers as per the example on ESRI https://esri.github.io/esri-leaflet/examples/basemap-with-labels.html.

In my application the Imagery base-map displays just fine. However none of the label layers do. Below is the code which I use to show the layers.

var esriImagery = L.esri.basemapLayer('Imagery').addTo(map); /*This works*/
var esriLabels = L.esri.basemapLayer('ImageryLabels').addTo(map); /*This does not*/

If I load the Imagery layer on its own it is fine. However using the exact same line of code with just the layer name changed, the ImageryLabels layer does not display. I investigated and the cause is as follows:

map.on('baselayerchange', function (e) {
console.log(e.layer);
});

Finally, the exact same code works just fine on two pages where the map is full screen and takes up the entire page. This issue is only occurring on a page where the map is contained in a div located to the right of other content on the page, probably not of relevance but just in case.

I'd include more code but aside from the basic line to add the basemap layer there really seems to be no point since it works just fine for all other basemap layers except the labels layers. Is there perhaps something special about the ESRI labels layers which I am missing?

I'd appreciate hearing if anyone else has encountered this issue and also any advice or pointers.

-

Upvotes: 0

Views: 273

Answers (1)

john gravois
john gravois

Reputation: 404

If you can put together a simplified reproducible test case, it would be immensely helpful because i don't see the error you describe here:

const map = L.map('map').setView([45.528, -122.680], 13);
L.esri.basemapLayer("Imagery").addTo(map);
L.esri.basemapLayer("ImageryLabels").addTo(map);
L.esri.basemapLayer("ImageryTransportation").addTo(map);

https://jsbin.com/cijafog/edit?html,output

Upvotes: 0

Related Questions