pubnub / eon-map

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

Adding additional Layers (markers and lines) #30

Closed chris-safetravels closed 6 years ago

chris-safetravels commented 6 years ago

Just wondering if you have any examples of adding lines. We have referenced API info for Mapbox but receive errors. Note - we are implementing in Ionic mobile framework

var map = eon.map({ pubnub: pubNub, id: 'map', mbToken: this.mbToken, mbId: this.mbId, channelGroups: [this.channelGroup], connect: this.connect(this), history: false,

  options: {
    zoomAnimation: false,
    tileLayer: 'safetravels.cjln3hfpn3tlb2vs6et264mme-9xcwi',
    featureLayer: function(){
        var geojson = [
          {
            "type": "Feature",
            "geometry": {
              "type": "LineString",
              "coordinates": [
                [-77.03238901390978,38.913188059745586],
                [-122.414, 37.776]
              ]
            },
            "properties": {
              "stroke": "#fc4353",
              "stroke-width": 5
            }
          }
        ];
L.geoJson(geojson ).addTo(map);
  }
  },

});

Error:

TypeError: Cannot set property 'accessToken' of undefined TypeError: Cannot set property 'accessToken' of undefined at new create (eon.js:9935) at Object.window.eon.map (eon.js:10169) at HomePage.webpackJsonp.194.HomePage.ngOnInit