簡體   English   中英

如何在Leaflet地圖上打印/顯示/繪制MultiPolygon GeoJSON

[英]How to print/display/draw a MultiPolygon GeoJSON on a Leaflet map

我正在嘗試在Leaflet地圖中顯示GeoJSON MultiPolygon對象。 我從PostgreSQL數據庫中獲取它作為JSON,並將其轉換為GeoJSON。

我在GeoJSONLint中驗證了de MultiPolygon對象,它沒問題: 在此輸入圖像描述

但我無法在我的應用程序中完成此任務=(

這是我的代碼:

       $http.get(URI_SERVICE+"buscar-clase/"+JSON.stringify(params))
            .success(function (data) {
                console.log(L.multiPolygon(data.coordinates).toGeoJSON());
                adaLayer.clearLayers();
                adaLayer = L.geoJson(L.multiPolygon(data.coordinates).toGeoJSON(), {
                    style: function () {
                        return {weight: 1, color: "#000000"}
                    }
                });
                adaLayer.addTo(map);
            }).error(function (err) {
                console.log(err);
        });

為了記錄, map var工作正常,我已經打印了GeoJSON的其他層。

L.geoJSON整個有效載荷,而不僅僅是坐標數組。 喜歡

        adaLayer = L.geoJson(data, {
            style: function () {
                return {weight: 1, color: "#000000"}
            }
        });

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM