perliedman / leaflet-realtime

Put realtime data on a Leaflet map
ISC License
743 stars 167 forks source link

Track two marker in realtime. #183

Closed marketcode closed 2 years ago

marketcode commented 2 years ago

Hi guys, does anyone have any tips how I can make 2 or more markers moving simultaneously?

perliedman commented 2 years ago

Just make sure the GeoJSON features have different ids, or that you use the getFeatureId option to point out which property to use as unique id for each feature.

From the docs:

To be able to figure out when new features are added, when old features are removed, and which features are just updated, Leaflet Realtime needs to identify each feature uniquely. This is done using a feature id. Usually, this can be done using one of the feature's properties. By default, Leaflet Realtime will try to look for a called property id and use that.