Search code examples
pythongisshapely

How to simplify boundary geometries in shapely


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.


Solution

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