Files & formats
Reading and writing shapefiles, GeoPackages, GeoJSON and CSV — and what breaks in each.
Everything on Spatial Workflow about files & formats, in the order that usually works: understand the idea, then run the task, then fix it when it goes wrong. 82 guides in total.
22 learning paths run through this topic — follow one if you would rather work through a route than pick a single guide.
🧭 Start with the concepts
The ideas the how-to guides below assume you already have.
- WKT, WKB and GeoJSON: How Geometry Is Actually Stored wkt wkb geojson difference
- GIS Vector File Formats Compared: Shapefile, GeoPackage, GeoJSON, Parquet gis vector file formats compared
- What GDAL and OGR Actually Are (and Why Everything Depends on Them) what is gdal ogr
- Fiona vs pyogrio: How GeoPandas Reads and Writes Files fiona vs pyogrio
- QGIS Data Providers Explained: How QGIS Reads Any Data Source qgis data provider explained
- PostGIS Explained: When a Spatial Database Beats a Folder of Files postgis vs shapefile when to use
- How PostGIS Stores Geometry: SRID, EWKB and the Typed Column postgis geometry column srid
- The Raster Data Model Explained: Bands, dtype, NoData and the Transform raster data model python
- GeoParquet and Columnar Storage Explained: Why It Reads So Much Faster geoparquet explained python
- The OpenStreetMap Data Model Explained for Python Users openstreetmap data model
- Spatial Web Services Explained: WFS, WMS and OGC API Features wfs wms explained
- LAS, LAZ and COPC Explained: How Point Clouds Are Stored las laz copc explained
- PMTiles and MBTiles Explained: Tile Archives Without a Server pmtiles mbtiles explained
- GeoJSON, Vector Tiles or Parquet: Choosing an API Response Format api response format geojson
- NetCDF and Gridded Data Explained: Dimensions, Variables and Attributes netcdf explained
- CF Conventions Explained: How a NetCDF File Says What Its Numbers Mean cf conventions netcdf
- GRIB, NetCDF or Zarr: Choosing a Format for Gridded Data grib netcdf zarr difference
- Level of detail explained for 3D city models lod 3d city model
- CityJSON and CityGML explained cityjson citygml explained
⚙️ Then do the task
Step-by-step walkthroughs with code you can copy and adapt.
- How to Read GeoJSON in Python with GeoPandas read geojson python geopandas
- How to Read a CSV with Coordinates as a GeoDataFrame csv to geodataframe python
- How to Read and Write GeoPackage Files in Python geopackage python geopandas
- How to Connect GeoPandas to PostGIS geopandas postgis connection
- How to Read a Shapefile in Python with GeoPandas read shapefile geopandas
- How to Export GeoJSON in Python with GeoPandas export geojson geopandas
- How to Clean Messy CSV Coordinates into a Reliable GeoDataFrame clean csv coordinates
- How to Batch Convert Shapefiles to GeoPackage in Python batch convert shapefile to geopackage python
- How to Merge Many Shapefiles into One File in Python merge multiple shapefiles python geopandas
- How to Batch Export a GeoDataFrame to Multiple Formats in Python export geodataframe multiple formats python
- How to Move Data Between QGIS and GeoPandas qgis geopandas data exchange
- How to Reduce GIS File Size in Python Without Wrecking the Data reduce gis file size python
- How to Package GIS Deliverables into Zipped Bundles with Python package gis deliverables zip python
- How to Write a GeoDataFrame to PostGIS write geodataframe to postgis
- How to Set Up a Python GIS Environment That Actually Works python gis environment setup
- How to Standardise Attribute Values Against a Controlled Vocabulary standardise attribute values python
- How to Test a GIS Script That Reads and Writes Files test gis file io pytest
- How to Work with a Custom or Local CRS in Python custom crs proj string python
- How to Open Any Spatial File in Python When You Do Not Know the Format open any spatial file python
- How to Download OpenStreetMap Data in Python with OSMnx download openstreetmap python
- How to Query the Overpass API from Python overpass api python
- How to Download Data from a WFS Service in Python download wfs python
- How to Read a LAS or LAZ File in Python with laspy read las laz python laspy
- How to Write Partitioned GeoParquet and Query It with Filters partitioned geoparquet python
- How to Load GPS Tracks into Python as Trajectories load gps tracks python
- How to Read Shapefiles, GeoJSON and GeoParquet in DuckDB duckdb read spatial files
- How to Add a Download Button for Filtered Spatial Data download button spatial data app
- How to Open a NetCDF File in Python with xarray open netcdf python xarray
- How to Convert NetCDF to GeoTIFF in Python netcdf to geotiff python
- How to Read GRIB Weather Forecast Data in Python read grib python cfgrib
- How to Compact an H3 Cell Set to Store a Region Cheaply h3 compact cells
- How to Download Census Boundaries in Python download census tract shapefile python
- How to strip GPS coordinates from photo metadata in Python strip exif gps python
- How to write a metadata record for a dataset in Python write spatial metadata python
- How to read the metadata already inside your spatial files read gis file metadata python
- How to store metadata inside a GeoPackage geopackage metadata python
- How to read a CityJSON city model in Python read cityjson python
- How to export a 3D city model to glTF in Python export gltf python gis
- How to write a variable-rate prescription map variable rate prescription map
🔧 When it breaks
The errors this topic produces, with the cause explained rather than just the command.
- Fiona ImportError When Using GeoPandas: How to Fix It fiona importerror geopandas
- GeoPandas Not Reading Shapefile: Common Causes and Fixes geopandas not reading shapefile
- Why Are My Shapefile Column Names Truncated? How to Fix It shapefile column names truncated
- RasterioIOError: Not Recognized as a Supported File Format (How to Fix) rasterioioerror supported file format
- GeoPandas "No Geometry Column" Error: How to Fix It geopandas no geometry column
- Python glob Is Not Finding All My Shapefiles: How to Fix It glob not finding files python
- Garbled Attribute Text and UnicodeDecodeError from a Shapefile: How to Fix Encoding shapefile encoding error python
- GeoPandas to_file() Fails on a Column Type: How to Fix It geopandas to_file field type error
- Mixed Geometry Types Error When Saving a GeoDataFrame: How to Fix It mixed geometry types geopandas
- Rasterio Output GeoTIFF Is Black or Empty: How to Fix It rasterio output black empty
- PostGIS "relation does not exist" and Permission Errors: How to Fix Them postgis relation does not exist
- GeoJSON Downloaded from an API Is Empty or Truncated api geojson truncated
- A LAZ File Will Not Open in Python laz file will not open
- GDAL Cannot Open an S3 or HTTPS Path gdal cannot open s3 url
- Fixing Addresses That Break on Accents and Encoding address encoding accents
- Fixing Missing or Substituted Fonts in an Exported Map PDF map pdf fonts missing
- Fixing ST_Read Failures on Spatial Files in DuckDB duckdb st_read fails
- Fixing a Geometry Column Lost on Export from DuckDB duckdb geometry lost export
- Fixing an Uploaded File That Breaks a Map App uploaded file breaks map app
- Fixing xarray's "Did Not Find a Match in Any of xarray's Installed Backends" xarray did not find a match installed backends
- Fixing Census Joins That Fail Because Leading Zeros Were Dropped census geoid leading zeros join fails
- A shared file still contains the original coordinates file still contains original coordinates
- Metadata disappears when you convert the file metadata lost format conversion
- A prescription map is rejected by the machine controller prescription map not loading
Learning paths through this topic
A curated route rather than a list — the guides in the order that builds on itself.
-
Finding & Fetching Data
Get the data before you analyse it — from OSM, web services and satellite catalogues.
Open path → -
Raster Analysis
Read, reproject, clip and summarise raster data in Python.
Open path → -
Spatial SQL & PostGIS
Move the heavy lifting from Python into the database.
Open path → -
GIS Data Cleaning
Turn messy spatial data into analysis-ready datasets.
Open path → -
Batch Processing
Process many files at once, reliably.
Open path → -
QGIS Automation
Automate QGIS with PyQGIS and Processing models.
Open path → -
LiDAR & Point Clouds
Millions of points, and the surfaces worth deriving from them.
Open path → -
Cloud-Native GIS
Read the part you need, not the file it lives in.
Open path → -
Publishing Web Maps
Get the data into a browser without shipping the whole dataset.
Open path → -
Movement & Time
Tracks are not points — the order and the clock are the data.
Open path → -
Geocoding & Addresses
Address text is data too — and it is the messiest data in the file.
Open path → -
Cartography & Map Design
The map is correct. Now make it readable.
Open path → -
DuckDB for Spatial Data
A spatial database with no server, reading the file you already have.
Open path → -
Serving Spatial Data
The dataset is finished. Now other people need it over HTTP.
Open path → -
Maps, Apps & Dashboards
Let the reader ask their own question — within a budget.
Open path → -
Gridded & Climate Data
A raster with a time axis, a calendar and forty years in one file.
Open path → -
H3 & Global Grids
Give every point a cell id and half the geometry work becomes a join.
Open path → -
Census & Demographics
The most-used open data there is, and the easiest to map wrongly.
Open path → -
Geoprivacy & Anonymisation
A coordinate is an identifier. Release it as if it were one.
Open path → -
Metadata, Licensing & Provenance
A layer nobody can describe, cite or re-run is a layer nobody should use.
Open path → -
3D & Buildings
A footprint plus a height is not a building, but it is most of one.
Open path → -
Agriculture & Crops
One field, one season, and a dozen ways to measure it wrong.
Open path →
Related topics
Subjects that keep coming up alongside this one, most overlap first.