Saturday 24 March 2018

ogr - Free tool to simplify parcel shapefiles?


Is there any tool available which let's me run millions of parcel shapefiles and simplify them?



Answer



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

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...