mardi 30 décembre 2014

gdal_polygonizer creates wrong geojson (?)


I have this PNG and I use gdal_polygonize 0VxOhek.png -f "geojson" 0VxOhek.geojson This is the output. There is a "features"-array which contains many objects with "type", "properties" and "geometry" elements. "geometry" contains "type" and "coordinates". "coordinates" is a 3 dimensional array. Usually its outermost array contains one array which contains arrays with coordinates in them. So each element of the "features"-array looks like this:



{ "type": "Feature", "properties": { "DN": 2 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ X1, Y1 ], [ X2, Y2 ], [ X3, Y3 ], [ X4, Y4] ] ] } }


But as you can see in the output file there are some "coordinates" with more than one array in the outermost array of "coordinates" (Begin of counting at 0: 48th (line 53), 50th (line 55), 54th, 64th). These "coordinates" look like this: "coordinates": [ [ [ X1, Y1 ], [ X2, Y2 ], [ X3, Y3 ] ], [ [ X4, Y4 ], [X5, Y5], [X6, Y6] ] ]


What happened? Is there a way to prevent that? Can I just combine these 2 into one array?





Aucun commentaire:

Enregistrer un commentaire