Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get DynamicMapLayer.getLayers() does not return layers #781

Closed
bbehling opened this issue May 17, 2016 · 2 comments
Closed

Get DynamicMapLayer.getLayers() does not return layers #781

bbehling opened this issue May 17, 2016 · 2 comments

Comments

@bbehling
Copy link
Contributor

  • Browser and version:
    Chrome 50.0.2661.102 m
  • Version of Leaflet (L.version):
    1.0.0-rc.1
  • Version of esri Leaflet (L.esri.VERSION):
    2.0.0
  • I'm loading/bundling the library using:

ie: [CDN](https://cdn.jsdelivr.net/leaflet.esri/2.0.0/esri-leaflet.js

Steps to reproduce the error:

  1. Add a dynamic layer to the map
    2.Wait for the layer to load
  2. In the load callback function, call getLayers() on the dynamic layer

What happens is getLayers() returns false.

I was expecting an array of layers on the MapService that are being shown

http://jsbin.com/datogesuja/8/edit?html,output

@jgravois
Copy link
Contributor

the API reference could be a lot clearer on this, but the getLayers() method doesn't fire off a request for service metadata describing which layers are visible by default, it simply passes back information present in the layer constructor options.

my reply in issue #566 is relevant here too because i describe the same technique you'd use to fetch the layers and their default visibility.

@jgravois
Copy link
Contributor

happy to discuss this more if it'd be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants