我正在尝试在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"}
}
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句