pubnub / eon-map

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

multiple markers from multiple sources #24

Closed faysal515 closed 6 years ago

faysal515 commented 6 years ago

I want to display multiple markers data coming from multiple channels. is it possible? here's my data structure of my message

[{
latlng: [1.00,1.00]
}]

right now if I initialize my constructor like below, no matter which channels my data comes from, only one marker is rendered on the map and updated

var map = eon.map({
          pubnub: pn,
          id: 'map',
          options: {
          center: [23.7167498, 90.4154881], // [lat, lng]
          zoom: 14,
          },
          mbToken: '....',
          mbId: '....',
          channels: ['bus-01','bus-02']
        });
ianjennings commented 6 years ago

This is an example of using two different publishing sources: https://github.com/pubnub/eon-map/blob/master/examples/distributed.html

You need to supply a unique key parameter for your latlng. Try using objects instead:

{myKey: {
latlng: [1.00,1.00]
}}