【问题标题】:Change the Filtering marker cluster groups example from mapbox从 mapbox 更改过滤标记集群组示例
【发布时间】:2018-02-08 08:35:18
【问题描述】:

我想从 mapbox.js https://www.mapbox.com/mapbox.js/example/v1.0.0/filtering-marker-clusters/ 更改示例。现在我的问题是我想使用本地 geojson 变量而不是

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

喜欢

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
    ]
  }
}

]

【问题讨论】:

    标签: javascript mapbox mapbox-marker


    【解决方案1】:

    你可以用你的geojson直接调用featureLayer

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多