-3

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

1 Answer 1

3

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')

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.