I am trying to find the points from a geopandas frame that are inside the polygons from another geopandas frame. The code that I am using is the following:
Most of the times it works, but for one file it gives me this error:
TopologyException: Input geom 0 is invalid: Ring Self-intersection at or near point -71.126795046686823 42.767412284376533 at -71.126795046686823 42.767412284376533
this error is raised when I do
My understanding is that (at least) one of the polygons is invalid.
I don't mind if I drop some polygons, I don't need to be 100% accurate. The question is: How do I drop the rows from a geopandas frame that are raising the TopologyException
The polygon dataframe is coming from: https://docs.digital.mass.gov/dataset/massgis-data-2016-land-coverland-use
The particular shp file with problems: http://download.massgis.digital.mass.gov/shapefiles/lclu2016/LCLU_R02C18.zip