pubnub / eon-map

Realtime maps with PubNub and MapBox.
https://www.pubnub.com/developers/eon/
MIT License
135 stars 51 forks source link

How does one display multiple points to the map properly? #4

Closed chrismanderson closed 8 years ago

chrismanderson commented 8 years ago

How do I have multiple points displayed on the map, all animated when their position is updated, but without passing the array of all location points into the Pubnub channel at once? E.g., if I have three cars I want to track, each car would push up their own location separately. The examples such as https://www.pubnub.com/developers/eon/map/flight/ seem to imply you need to bach all of the location points together. I'd love to know what I'm missing!

ianjennings commented 8 years ago

Hey @chrismanderson,

You can absolutely plot different points from different devices. Each value within message should include a unique key.

message:  
      {
        66e234a: {
           latlng: [

The flight example in which you link doesn't batch the location, only a subset of planes are updated on every subscribe.

ianjennings commented 8 years ago

You should also look at the "distributed" example which accomplishes exactly this: https://github.com/pubnub/eon-map/blob/master/examples/distributed.html