3

I have a gpkg with multiple tables, and I am trying to load it with geopandas:

import geopandas as gpd
filename = '~/example.gpkg'
gdf = gpd.read_file(filename)'

This returns the first table/layer in the gpkg. Is there any way to access the other layer, i.e. something like:

filename = '~/example.gpkg|second_table'

I'm guessing I might need to use fiona directly, but couldn't figure it out from the docs

4

Use layer parameter:

gdf = gpd.read_file(r'C:\folder\geopackage.gpkg', layer='somelayername')

read_file uses fiona.open, see: fiona.open docs

  • 1
    That was simple enough, thank you, don't know how I missed that – Eliav S.T. Jan 7 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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