How do I assign id tags to leaflet polylines so that I can show/hide or do other operations on them later? I'll have around 100+ polylines. Is there a way I can set an id property to it?
Also I noticed the leaflet module has a leaflet-src.js file in it. Can I add the property to the L.Polyline using this.ident and add it while constructing the polyline in the html file?
When you create a new L.Polyline
, you can add a id
key to the options
hash which you can then operate on/inspect later while looping through the featureGroup
or other more vanilla JavaScript grouping that contains it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.