-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
No method to get all markers back #5821
Comments
That's correct, and by design to keep the API and memory use small. If you need to remove all markers at once, you can keep an array of the markers you've added, and call remove on each of them. |
This requires to store a state, which usually introduces unnecessary complexity in large applications. |
I'm using a Polymer 2 Component for Mapbox-GL <mapbox-gl map="[[map]]">
<template is="dom-repeat" items="[[markers]]">
<mapbox-gl-marker ... ></mapbox-gl-marker>
</template>
</mapbox-gl> Beacuse of the way it adds markers inside a
Is there a way similar to map.styles._layers // I could not found the markers in here where I can see the marker references? I would like to remove a single marker from an array. |
@ralexrdz per #5821 (comment) we don't store references for markers
I think you'll have to make the change in the Polymer component if you want to store marker references. |
Seems there is no good way to get all markers back. This might be useful if you want to clear the map or apply something to all markers.
The text was updated successfully, but these errors were encountered: