In the API version 2.3.X and lower there was a lovely WebMap object method called get_layer() that allowed you to retrieve the layer definition using a title parameter and supplying in the name of the layer as a string. See the docs here.
With 2.4.0 this neat functionality has been removed. We now access the layer via m.content.layers[index_position], which means I need to know the index of the layer in the first place. I now have to write a custom method to get the layer of interest based on the title!
Please reinstate this functionality and bring back a way for us to get the WebMap (Map) layer by the layer title!
Thanks for posting this. When making such a big shift it's difficult to gauge the importance of certain methods and properties that were previously available.
Since a lot of methods now rely on layer index we will make a method that allows you to get the layer and the index of said layer more easily.
Why would you remove this? Please bring it back
Hello everyone,
Thank you for adding your voices to this. At version 2.4.1 of the API we have brought back the `get_layer` and `get_table` methods so you can search by title.
To make layer indexing better as well we added two new methods called: `layer_info` and `table_info`
You can call them like this:
```
m = Map()
m.content.layer_info()
```
This will return a dataframe of the layers, their index, and some other info.
Hope this helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.