Is there any tool available which let's me run millions of parcel shapefiles and simplify them?
-
1what do you mean by simplify, the edge?– artwork21May 12, 2011 at 1:48
-
1I think I would be concerned about running simplify on polygons without some type of topology. I don't even think esri will manage two edges being simpplified simultaneously so they remain consistent. Maybe I'm wrong.– Brad NesomMay 12, 2011 at 4:21
7 Answers
Version 9.0 of GDAL/OGR added the -simplify option to the ogr2ogr command. The documentation indicates that it preserves topology.
-simplify tolerance: (starting with GDAL 1.9.0) distance tolerance for simplification. This method will preserve topology, in particular for polygon geometries.
Example usage:
ogr2ogr outfile.shp infile.shp -simplify 0.000001
You could try Shapely - a Python API built on top of GEOS. As both Shapely and GDAL have Python libraries you can easily combine them to data from many different sources (including shapefiles) and then simplifying and exporting as desired.
The only downside may be speed if you are doing millions of features - it could be faster to use GEOS or JTS directly.
See the simplify method:
All points in the simplified object will be within the tolerance distance of the original geometry. By default a slower algorithm is used that preserves topology. If preserve topology is set to False the much quicker Douglas-Peucker algorithm is used.
>>> p = Point(0.0, 0.0)
>>> x = p.buffer(1.0)
>>> x.area
3.1365484905459389
>>> s = x.simplify(0.05, preserve_topology=False)
>>> s.area
3.0614674589207187
ogr2ogr has a "segmentize" option that appears to do what you need: GDAL ogr2ogr documentation
From that page:
-segmentize max_dist: (starting with GDAL 1.6.0) maximum distance between 2 nodes. Used to create intermediate pointsspatial query extents
GRASS v.generalize
-
I made some test and as of today, all methods suggested here and relying on GEOS (ogr2ogr with -simplify, shapely, PostGIS's ST_SimplifyPreserveTopology function) produce topological anomalies (i.e. holes/overlaps between polygons). Only with GRASS I had good results.– capootiSep 18, 2012 at 15:42
Inspire from Mapshaper, but directly in local, look on https://github.com/migurski/Bloch
-
thanks for your response. I guess the issue here is what to do if no topology is define with the shapefile Jun 26, 2012 at 14:48