2

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?

David W.
  • 1,074
  • 4
  • 10
  • 22

2 Answers2

1

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.

bjornd
  • 22,397
  • 4
  • 57
  • 73
  • Thanks, however my source files are not SHP (they're MID/MIF). I might look in to it though. I also found this javascript simplifier: http://bost.ocks.org/mike/simplify/. Will post in this thread if progress. – David W. Nov 20 '12 at 22:09
  • It should work with MID as well, since the GDAL/OGR library is used to load data, which supports wide variety of GIS formats. BTW I don't think this script supports boundary-safe simplification. – bjornd Nov 20 '12 at 22:49
  • Alright. Will look into it. I do think the link posted should support boundary safe simplification as it states something about adjecent triangles (again, haven't gone that deeply into it yet). – David W. Nov 21 '12 at 08:21
  • @Div No adjacent triangles is just about the method of simplification of one polygon. BTW what is the size of your source file? I would like to test it with my script. – bjornd Nov 21 '12 at 09:00
  • I have three diffrent source files for different region types. I'll be glad to send you one of them, it's around 2MB. echo.bjornd@g? – David W. Nov 21 '12 at 12:20
  • Yep, send them to me and I'll make tests today. – bjornd Nov 21 '12 at 13:46
  • Thanks for (edited) answer. I *will* check it out, but I have tested the code from this blogpost http://boraberan.wordpress.com/2012/10/23/simplifying-multiple-neighboring-polygons/ It's in C# wich I am more familiar with. – David W. Nov 22 '12 at 15:29
-1

In arcgis you have Simplify polygon: http://resources.arcgis.com/en/help/main/10.1/index.html#//007000000011000000

nicogis
  • 129
  • 3