0
votes

I want to change the example from mapbox.js https://www.mapbox.com/mapbox.js/example/v1.0.0/filtering-marker-clusters/. Now my problem is i want to use a local geojson variable instead of

    .loadURL('/mapbox.js/assets/data/stations.geojson') 

like

var geojson = {
"features": [
{
  "type": "Feature",
  "properties": {
    "name": "Van Dorn Street",
    "marker-color": "#0000ff",
    "marker-symbol": "rail-metro",
    "line": "blue"
  },
  "geometry": {
    "type": "Point",
    "coordinates": [
      -77.12911152370515,
      38.79930767201779
    ]
  }
},
{
  "type": "Feature",
  "properties": {
    "name": "Franconia-Springfield",
    "marker-color": "#0000ff",
    "marker-symbol": "rail-metro",
    "line": "blue"
  },
  "geometry": {
    "type": "Point",
    "coordinates": [
      -77.16797018042666,
      38.766521892689916
    ]
  }
}

]

1

1 Answers

0
votes

You can directly call featureLayer with your geojson:

L.mapbox.featureLayer(geojson)
    .on('ready', function(e) {
        ...
    });