I loaded a GeoPackage into Python and I can't figure out how to list all the layers in the file. How do I do that?

Input: GeoPackage loaded into Python.

Desired output: A list of the layers in the GeoPackage.

Code for connecting to GeoPackage:

import geopandas as gpd    
gpkg = 'path/to.gpkg'
# Missing: list layers
  • 1
    What code did you use to load the Geopackage into Python?
    – PolyGeo
    Commented Oct 4, 2021 at 4:10
  • Is was less efficient than the code in the answer lol
    – Zorro
    Commented Oct 4, 2021 at 4:57
  • 1
    That looks like it just sets a string variable to a full path name representing the GeoPackage file. I thought you must have been creating a GeoPackage object using something, and just didn't know how to access a property with its layers .
    – PolyGeo
    Commented Oct 4, 2021 at 5:30
  • 1
    – user2856
    Commented Oct 4, 2021 at 7:04

2 Answers 2


It's simple to do this using Fiona. I prefer using GeoPandas to read the Geopackage, and then Fiona to list the layers:

import geopandas as gpd
import fiona

gpkg = 'path/to.gpkg'
layers = fiona.listlayers(gpkg)

You'll end up with the layer names as a list.


Using the GeoDjango API you can do the following:

from django.contrib.gis.gdal import DataSource

gpkg = DataSource('path/to.gpkg')
layers = [layer.name for layer in gpkg]

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.