Working with Geospatial Data in Python
Joris Van den Bossche
Open source software developer and teacher, GeoPandas maintainer
IPIS: International Peace Information Service
Image: Connormah, CC BY-SA 3.0, from Wikimedia Commons
IPIS: International Peace Information Service
Image: G.A.O, public domain, from Wikimedia Commons
Reading files: geopandas.read_file("path/to/file.geojson")
Supported formats:
.shp
, .dbf
, .shx
, .prj
, ...).gpkg
)& PostGIS databases!
Writing a GeoDataFrame to a file with the to_file()
method:
# Writing a Shapefile file
geodataframe.to_file("mydata.shp", driver='ESRI Shapefile')
# Writing a GeoJSON file
geodataframe.to_file("mydata.geojson", driver='GeoJSON')
# Writing a GeoPackage file
geodataframe.to_file("mydata.gpkg", driver='GPKG')
Working with Geospatial Data in Python