This question is related to: Filtering by geometry type in GeoPandas
I need to check if my geodataframe contains 'MultiPolygon' type.
Below is my attempt, but it doesn't work. According to documentation it should work, I think. How can I do it?
import geopandas as gpd
from shapely.geometry import Point, Polygon, MultiPolygon, MultiPoint, LineString, MultiLineString
geo_dict= {"ogc_fid":[58], "geometry":[MultiPolygon([Polygon([(1, 2), (2, 1), (3, 2), (1, 2)])])]}
gdf= gpd.GeoDataFrame(geo_dict)
result1 ='MultiPolygon' in (gdf['geometry'].geom_type)
result2 = MultiPolygon in (gdf['geometry'].geom_type)
result3 ='Polygon' in (gdf['geometry'].geom_type)
result4 = Polygon in (gdf['geometry'].geom_type)
print(result1) # prints False
print(result2) # prints False
print(result3) # prints False
print(result4) # prints False