小编Gui*_*lic的帖子

Leaflet.js和JSON数据:优化和性能

我目前正在使用Javascript构建我们客户数据的交互式地图.

到目前为止,我已经掌握了基础知识,但是当我开始使用标记大约500个poi或使用圆形标记超过10,000个时,性能开始下降....如果有人可以就如何优化我已经获得的东西提供一些建议或者我最好移动到像jongo这样适当的数据库用于json数据,或者使用Node Js工作服务器端?

任何建议将不胜感激:)

    var apiKey  = 'BC9A493B41014CAABB98F0471D759707',
          styleID = '108219';
    //    styleID = '997';


   // var map = L.map('map').setView([54.550, -4.433], 7);

      var southWest   = new L.LatLng(61.029031, 4.746094),
            northEast   = new L.LatLng(48.786962 ,-13.183594),
            bounds      = new L.LatLngBounds(southWest, northEast);

        var mapcenter      = new L.LatLng(53.457393,-2.900391);
        var map         = new L.Map('map',
                                {
                                    center: mapcenter,
                                    zoom: 7,
                                    // maxBounds: bounds,
                                    zoomControl: false
                                });

        var cloudmadeUrl = generateTileURL(apiKey, styleID),
            attribution = 'Map data © OpenStreetMap contributors.',
            tileLayer = new L.TileLayer(
                                cloudmadeUrl,
                                {
                                    maxZoom: 18,
                                    attribution: …
Run Code Online (Sandbox Code Playgroud)

javascript performance maps json leaflet

6
推荐指数
1
解决办法
7590
查看次数

标签 统计

javascript ×1

json ×1

leaflet ×1

maps ×1

performance ×1