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

  • 1
    Within a GIS software you're looking for a Dissolve tool. From there you could output a new GeoJSON that has it as a single shape. – Chris W Mar 27 '15 at 18:50
  • Thanks! I made some research but could not find a proper way to use it with gdal. Do you know how to use it? – Selphiron Mar 27 '15 at 22:06
  • 1
    The first answer at this question uses gdal (ogr2org and requires spatialite support) and has the command line. And here's a blog post tutorial. Note I'm not directly familiar with the process and am only providing resources I found. Alternatively QGIS is a fairly robust, extensible, free GIS software with a GUI that has a dissolve command built in. Might be overkill for what you want though. – Chris W Mar 28 '15 at 1:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.