geopandas.GeoSeries.is_valid#
- property GeoSeries.is_valid[source]#
Returns a
Series
ofdtype('bool')
with valueTrue
for geometries that are valid.Examples
An example with one invalid polygon (a bowtie geometry crossing itself) and one missing geometry:
>>> from shapely.geometry import Polygon >>> s = geopandas.GeoSeries( ... [ ... Polygon([(0, 0), (1, 1), (0, 1)]), ... Polygon([(0,0), (1, 1), (1, 0), (0, 1)]), # bowtie geometry ... Polygon([(0, 0), (2, 2), (2, 0)]), ... None ... ] ... ) >>> s 0 POLYGON ((0 0, 1 1, 0 1, 0 0)) 1 POLYGON ((0 0, 1 1, 1 0, 0 1, 0 0)) 2 POLYGON ((0 0, 2 2, 2 0, 0 0)) 3 None dtype: geometry
>>> s.is_valid 0 True 1 False 2 True 3 False dtype: bool