How to print / display / draw MultiPolygon GeoJSON on the elevator map

I am trying to display a GeoJSON MultiPolygon object on a sheet map. I get it from a PostgreSQL database as JSON and I trnasform it in GeoJSON.

I tested the MultiPolygon object in GeoJSONLint , and this is normal: enter image description here

But I can not do this in my application = (

This is my code:

$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); }); 

For writing, the var map works fine, I printed other GeoJSON layers.

+6
source share
1 answer

Give L.geoJSON all the payload, not just an array of coordinates. how

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

Source: https://habr.com/ru/post/987433/


All Articles