vendredi 27 mars 2015

Merge multiple geojson-polygons


Lets say I have a very big image With a polygon in it:


enter image description here


I want to polygonize this very big image with gdal polygonize. But the image is too big, so I dont have enough memory to polygonize that properly (I know there are some options but forget them for a while). So I split this image into 4 images (black lines are the borders of each image):


enter image description here


Now I polygonize these 4 images and I obtain 4 GeoJSON-files with 2 polygons each (one bigger white polygon, and one smaller blue polygon). Then I put all polygons into one GeoJSON so that I have a GeoJSON with 8 polygons with it. When I import it in any GIS software it looks like the first picture but when I want to choose the blue polygon, I have to click on all 4 parts. Because in fact the result looks like this (orange = border of polygon)


enter image description here


So I need a way to merge polygons so that neighbour-polygons of the same color get merged to one polygon.


My images are of course a little bit more complex but I had to simplify it to a circle to show the problem





Aucun commentaire:

Enregistrer un commentaire