Search code examples
c#vector-graphicspolygonsjvectormapdouglas-peucker

Simplification of adjacent polygons


I'm working on converting some maps/regions of an old coordinate system to a simpler (less detailed) model for representing on the web (using jVectorMap). I have sucessfully used the Douglas Peucker-algorithm (from code found here: http://www.codeproject.com/Articles/18936/A-C-Implementation-of-Douglas-Peucker-Line-Approxi).

It is working quite well, but this implementation does not take into account that these regions align to each other (share borders), wich results in quite ugly result when using higher tolerance as shown below.

enter image description here

Is it possible to implement a solution where the regions will remain aligned?


Solution

  • If you have some experience with Python you can try simplification script which I have written to be part of the jVectorMap GIS converter. Unfortunately it's not finished yet: you need to install dependencies manually, define parameters inside of the script (paths, driver), etc.

    Just set the following parameters in the script:

    tolerance = 1000
    infile = 'Kn99_sve.MIF'
    outfile = 'map.mif'
    

    And change the driver name form ESRI Shapefile to MapInfo File.

    To run the script you need Python 2.7 and installed Python modules: gdal, shapely, anyjson.