How to simplify boundary geometries in shapely

Michael K picture Michael K · Apr 3, 2014 · Viewed 17.9k times · Source

I'm working with shapely to do GIS, but I'm running into memory errors when loading the geometry of each zip code into memory because the geometry is so jagged and complicated.

I'd like to make the shape smaller in memory by reducing the number of boundary points as low as possible without distorting the shape too much. Using the convex hull seems like one potential answer, as could simply throwing away lots of points from the boundary. I'm wondering if there's something already out there that solves this problem.

Answer

Mike T picture Mike T · Apr 22, 2014

Try using the geometry's simplify method, specifying a tolerance distance.