Ability to add/retrieve data from layer/popup
See original GitHub issueI’m not sure how to be able to append data to a layer (or even a popup), e.g. adding a custom ID to it, however I cannot append any data to a layer because I don’t know how to get the raw DOM element so I can use it with jQuery by doing so:
$.data(markerLayer, 'test', { id: '123' });
It would be nice to have an ability to be able to append data to a layer and able to retrieve it via events such as click, drag, etc.
Anyone is free to point me to the right direction to how to do this - on one note, this would be great if it exist in the Leaflet core. Google Maps allows you to do this.
Issue Analytics
- State:
- Created 11 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Pop-ups—ArcGIS Pro | Documentation
View data attributes in a pop-up ... A pop-up is a read-only display of attribute information. It is a convenient way to identify...
Read more >Pump Up Your Pop-ups With Arcade FeatureSets and ... - Esri
To do this within one of your own web maps, add a layer which you want to access data from (a contextual layer),...
Read more >Creating Dynamic Pop-ups in ArcGIS Online Web Maps and ...
This webinar will provide attendees with useful tips and tricks on how to create engaging popups in your ArcGIS Online web maps and...
Read more >Add a popup to a point on a map - Microsoft Learn
Mouse events are added to the symbol layer to trigger opening and closing the popup. When the marker symbol is hovered, the popup's...
Read more >ArcGIS Maps - reference layer pop-up
The hosted layer has its pop-up setup to display a single field from the data. However, Power BI does not pick this up...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It is much cleaner in this case to use the JS object as you get access to the JS object, but you don’t get access to the DOM objects. You can access them at myMarker._icon IIRC, but it’s usually not a good idea.
Maybe I am missing something but why is it better to append data to JS objects than to the DOM? I found this issue while looking at a way to use the data attribute so my markers can have the same behaviour as their counterparts (somewhere else on the page) when clicked on.
Also, @danzel example does not work for me, I have to do