I want to make a file geodatabase (.gdb) with GeoPandas and Fiona, but as long as I know there is no way to make a feature class without using ArcPy. Is there a way to make it?
1 Answer
You can create one by writing any GeoPandas dataframe to it:
import geopandas as gpd
from shapely.geometry import Point, LineString, MultiPolygon
out_db = r"/home/bera/Desktop/gistest/fgdb.gdb"
#Create some geometries
pnt = Point(1,1)
line = LineString([pnt, Point(1,2)])
polygon = MultiPolygon([pnt.buffer(distance=1)])
for layername, geom in zip(["Pointfc", "Linefc", "Polygonfc"], [pnt, line, polygon]):
df = gpd.GeoDataFrame(geometry=[geom], crs="EPSG:3006")
df.to_file(filename=out_db, layer=layername, driver='OpenFileGDB')