Convert gdb to geopackage using python script

140 views Asked by At

import geopandas as gpd

import fiona

Specify the paths

gdb_path = 'path_to_your.gdb'

geopackage_name = 'output.gpkg'

List all layers in the GDB

gdb_layers = fiona.listlayers(gdb_path)

Convert layers to GeoPackage

for layer_name in gdb_layers:

layer_gdf = gpd.read_file(gdb_path, layer=layer_name)

layer_gdf.to_file(geopackage_name, layer=layer_name, driver="GPKG")

Output: Process finished with exit code 0

Code is running and giving the following output but the geopackage file is still empty.

0

There are 0 answers