geopandas.read_file(filename, bbox=None, mask=None, rows=None, engine=None, **kwargs)[source]#

Returns a GeoDataFrame from a file or URL.


GeoPandas currently defaults to use Fiona as the engine in read_file. However, GeoPandas 1.0 will switch to use pyogrio as the default engine, since pyogrio can provide a significant speedup compared to Fiona. We recommend to already install pyogrio and specify the engine by using the engine keyword (geopandas.read_file(..., engine="pyogrio")), or by setting the default for the engine keyword globally with:

geopandas.options.io_engine = "pyogrio"
filenamestr, path object or file-like object

Either the absolute or relative path to the file or URL to be opened, or any object with a read() method (such as an open file or StringIO)

bboxtuple | GeoDataFrame or GeoSeries | shapely Geometry, default None

Filter features by given bounding box, GeoSeries, GeoDataFrame or a shapely geometry. With engine=”fiona”, CRS mis-matches are resolved if given a GeoSeries or GeoDataFrame. With engine=”pyogrio”, bbox must be in the same CRS as the dataset. Tuple is (minx, miny, maxx, maxy) to match the bounds property of shapely geometry objects. Cannot be used with mask.

maskdict | GeoDataFrame or GeoSeries | shapely Geometry, default None

Filter for features that intersect with the given dict-like geojson geometry, GeoSeries, GeoDataFrame or shapely geometry. CRS mis-matches are resolved if given a GeoSeries or GeoDataFrame. Cannot be used with bbox.

rowsint or slice, default None

Load in specific rows by passing an integer (first n rows) or a slice() object.

enginestr, “fiona” or “pyogrio”

The underlying library that is used to read the file. Currently, the supported options are “fiona” and “pyogrio”. Defaults to “fiona” if installed, otherwise tries “pyogrio”.


Keyword args to be passed to the engine. In case of the “fiona” engine, the keyword arguments are passed to or fiona.collection.BytesCollection when opening the file. For more information on possible keywords, type: import fiona; help( In case of the “pyogrio” engine, the keyword arguments are passed to pyogrio.read_dataframe().

geopandas.GeoDataFrame or pandas.DataFrame

If ignore_geometry=True a pandas.DataFrame will be returned.


The format drivers will attempt to detect the encoding of your data, but may fail. In this case, the proper encoding can be specified explicitly by using the encoding keyword parameter, e.g. encoding='utf-8'.

When specifying a URL, geopandas will check if the server supports reading partial data and in that case pass the URL as is to the underlying engine, which will then use the network file system handler of GDAL to read from the URL. Otherwise geopandas will download the data from the URL and pass all data in-memory to the underlying engine. If you need more control over how the URL is read, you can specify the GDAL virtual filesystem manually (e.g. /vsicurl/https://...). See the GDAL documentation on filesystems for more details (


>>> df = geopandas.read_file("nybb.shp")  

Specifying layer of GPKG:

>>> df = geopandas.read_file("file.gpkg", layer='cities')  

Reading only first 10 rows:

>>> df = geopandas.read_file("nybb.shp", rows=10)  

Reading only geometries intersecting mask:

>>> df = geopandas.read_file("nybb.shp", mask=polygon)  

Reading only geometries intersecting bbox:

>>> df = geopandas.read_file("nybb.shp", bbox=(0, 0, 10, 20))