I try to create a shapefile of the FAO/GAUL/2015/leve1 country regions of the LMIC's countries. For that I decided to use Python as it gave me access to the earthengine API and the geopandas librairy.
To create the geodataframe I proceed as such :
import ee
import geemap
import geopandas as gpd
ee.Initialize()
for i, row in df.iterrows():
# select the country
ee_country = ee.FeatureCollection("FAO/GAUL/2015/level1").filter(ee.Filter.eq('ADM0_CODE', row.GAUL))
country_json = geemap.ee_to_geojson(ee_country)
tmp = gpd.GeoDataFrame.from_features(country_json)
# add the country to the global gdf
gdf = tmp if i == 0 else pd.concat([gdf, tmp])
gdf.crs = "EPSG:4326"
gdf
(the df is containing the FAO GAUL ADM0_CODE)
Then I try to transform this GDF into a shapefile using
gdf.to_file('FAO_GAUL_2015_level1.shp')
But I get an error because I have shapely.geometry.collection.GeometryCollection in my gdf (with linestring embed so not shapelyfiable).
Is there a way to only kee the Polygon for revery lin that contain a Geometry collection ? or Is it possible to drop all the linestring from the geometry column ?