Clustering markers on mapbox / leaflet(mapbox/传单上的聚类标记)


我正在尝试在 mapbox 上设置集群地图,例如

I'm trying to set up a clustered map on mapbox, like

但他们的示例使用纯 .js 文件作为数据

But their example uses a plain .js file as data

而我唯一能从 mapbox 得到的是 .geojson

And the only thing I can get from mapbox is .geojson

有没有办法可以将 geojson 转换为 js(定期)?还是从 mapbox 导出一个 javascript 数组?

Is there a way I can convert the geojson to js (on a regular basis)? Or export a javascript array from mapbox?

最终将我的数据切换为 CSV 并找到了解析器.如果有人需要,这是有效的代码:

ended up switching my data to CSV and finding a parser. Here's the code that worked, if anyone needs it:

var url = '';

$.get(url, function(data) {
  var addressPoints = $.csv.toArrays(data);
  var map ='map', 'map-abc123').setView([20.30, 18.98], 2);
  var markers = new L.MarkerClusterGroup({ showCoverageOnHover: false });

  for (var i = 0; i < addressPoints.length; i++) {
    var a = addressPoints[i];
    var title = a[2];
    var marker = L.marker(new L.LatLng(a[0], a[1]), {
      icon: L.mapbox.marker.icon({'marker-size': 'small', 'marker-color': 'e8168c'}),
      title: title




var geojson = dataFromMapbox;
var lat;
var lng;
for(var i= 0;i<geojson.features.length;i++)
    lat = geojson.features[i].geometry.coordinates[0];
    lng = geojson.features[i].geometry.coordinates[1];

    //create a marker with those values, pass it to a MarkerCluster object





How do I can get a text of all the cells of the table using testcafe(如何使用 testcafe 获取表格中所有单元格的文本)
node_modules is not recognized as an internal or external command(node_modules 未被识别为内部或外部命令)
How can I create conditional test cases using Protractor?(如何使用 Protractor 创建条件测试用例?)
PhantomJS and clicking a form button(PhantomJS 并单击表单按钮)
Clicking #39;OK#39; on alert or confirm dialog through jquery/javascript?(在警报上单击“确定或通过 jquery/javascript 确认对话框?)
QunitJS-Tests don#39;t start: PhantomJS timed out, possibly due to a missing QUnit start() call(QunitJS-Tests 不启动:PhantomJS 超时,可能是由于缺少 QUnit start() 调用)