<i id='4DT4t'><tr id='4DT4t'><dt id='4DT4t'><q id='4DT4t'><span id='4DT4t'><b id='4DT4t'><form id='4DT4t'><ins id='4DT4t'></ins><ul id='4DT4t'></ul><sub id='4DT4t'></sub></form><legend id='4DT4t'></legend><bdo id='4DT4t'><pre id='4DT4t'><center id='4DT4t'></center></pre></bdo></b><th id='4DT4t'></th></span></q></dt></tr></i><div id='4DT4t'><tfoot id='4DT4t'></tfoot><dl id='4DT4t'><fieldset id='4DT4t'></fieldset></dl></div>

        <bdo id='4DT4t'></bdo><ul id='4DT4t'></ul>
      <tfoot id='4DT4t'></tfoot>

    1. <legend id='4DT4t'><style id='4DT4t'><dir id='4DT4t'><q id='4DT4t'></q></dir></style></legend>

      <small id='4DT4t'></small><noframes id='4DT4t'>

    2. mapbox/传单上的聚类标记

      时间:2023-08-08

        • <bdo id='OIRv2'></bdo><ul id='OIRv2'></ul>
          • <tfoot id='OIRv2'></tfoot>
                <tbody id='OIRv2'></tbody>
              <legend id='OIRv2'><style id='OIRv2'><dir id='OIRv2'><q id='OIRv2'></q></dir></style></legend>

                <i id='OIRv2'><tr id='OIRv2'><dt id='OIRv2'><q id='OIRv2'><span id='OIRv2'><b id='OIRv2'><form id='OIRv2'><ins id='OIRv2'></ins><ul id='OIRv2'></ul><sub id='OIRv2'></sub></form><legend id='OIRv2'></legend><bdo id='OIRv2'><pre id='OIRv2'><center id='OIRv2'></center></pre></bdo></b><th id='OIRv2'></th></span></q></dt></tr></i><div id='OIRv2'><tfoot id='OIRv2'></tfoot><dl id='OIRv2'><fieldset id='OIRv2'></fieldset></dl></div>

                <small id='OIRv2'></small><noframes id='OIRv2'>

                本文介绍了mapbox/传单上的聚类标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在尝试在 mapbox 上设置集群地图,例如 http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.388.html

                I'm trying to set up a clustered map on mapbox, like http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.388.html

                但他们的示例使用纯 .js 文件作为数据http://www.mapbox.com/mapbox.js/assets/realworld.388.js

                But their example uses a plain .js file as data http://www.mapbox.com/mapbox.js/assets/realworld.388.js

                而我唯一能从 mapbox 得到的是 .geojsonhttp://api.tiles.mapbox.com/v3/thebteam.map-w9jzcznw/markers.geojson

                And the only thing I can get from mapbox is .geojson http://api.tiles.mapbox.com/v3/thebteam.map-w9jzcznw/markers.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 = 'https://docs.google.com/spreadsheet/pub?key=abc123';
                
                $.get(url, function(data) {
                  var addressPoints = $.csv.toArrays(data);
                  var map = L.mapbox.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
                    });
                    marker.bindPopup(title);
                    markers.addLayer(marker);
                  }
                
                  map.addLayer(markers);
                
                });
                

                推荐答案

                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
                
                  }
                

                这篇关于mapbox/传单上的聚类标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:Leaflet React在功能组件中获取地图实例 下一篇:如何使用 LeafLet 创建商店地图

                相关文章

                最新文章

                    <i id='Ny5sy'><tr id='Ny5sy'><dt id='Ny5sy'><q id='Ny5sy'><span id='Ny5sy'><b id='Ny5sy'><form id='Ny5sy'><ins id='Ny5sy'></ins><ul id='Ny5sy'></ul><sub id='Ny5sy'></sub></form><legend id='Ny5sy'></legend><bdo id='Ny5sy'><pre id='Ny5sy'><center id='Ny5sy'></center></pre></bdo></b><th id='Ny5sy'></th></span></q></dt></tr></i><div id='Ny5sy'><tfoot id='Ny5sy'></tfoot><dl id='Ny5sy'><fieldset id='Ny5sy'></fieldset></dl></div>
                    <tfoot id='Ny5sy'></tfoot>

                    <small id='Ny5sy'></small><noframes id='Ny5sy'>

                    • <bdo id='Ny5sy'></bdo><ul id='Ny5sy'></ul>
                  1. <legend id='Ny5sy'><style id='Ny5sy'><dir id='Ny5sy'><q id='Ny5sy'></q></dir></style></legend>