Fixing KeyError: 'OGC:CRS84' When Ibis Reads GeoParquet
On this page
Problem statement
con.read_parquet() on a GeoParquet file stops with a bare KeyError: 'OGC:CRS84' from ibis/backends/sql/datatypes.py, before any row is read; on a file in New Zealand Transverse Mercator the key is 1,848 characters of JSON. The file is fine: GeoPandas and DuckDB open it. This page reproduces the error on 56,465 Overture Maps places in Auckland with Ibis 12.0 and DuckDB 1.5, traces it to the column type DuckDB reports, and gives two ways round it.
Quick answer
Read the file through con.sql() and cast the column to a plain GEOMETRY, which Ibis maps to its own geometry type:
places = con.sql("""
select * replace (geometry::GEOMETRY as geometry)
from read_parquet('data/overture-auckland-places-2026-11-18.0.parquet')
""")
print(places.schema()["geometry"], f"{places.count().execute():,} rows")
geospatial:geometry 56,465 rows
The cast turns GEOMETRY('OGC:CRS84') into GEOMETRY, which Ibis reads as its own geospatial:geometry type, and every spatial method works on the column from then on. All 56,465 places come through.
Where the CRS name in the type comes from
1. Reproduce the error
try:
con.read_parquet("data/overture-auckland-places-2026-11-18.0.parquet")
except KeyError as error:
print(f"{type(error).__name__}: {error}")
KeyError: 'OGC:CRS84'
The message is the whole of the error: no file name and no hint that it concerns the geometry column. It is raised while Ibis builds the table's schema, so read_parquet never returns a table to inspect.
2. Ask DuckDB what type it gives the column
raw = duckdb.connect()
for name, typ, *_ in raw.sql("describe select * from 'data/overture-auckland-places-2026-11-18.0.parquet'").fetchall():
if "GEOMETRY" in typ:
print(f"{name}: {typ}")
meta = pq.read_metadata("data/overture-auckland-places-2026-11-18.0.parquet").metadata
geo = json.loads(meta[b"geo"])
print("GeoParquet metadata:", geo["version"], geo["columns"]["geometry"].get("crs", "no crs key (the default, OGC:CRS84)"))
geometry: GEOMETRY('OGC:CRS84')
GeoParquet metadata: 1.0.0 no crs key (the default, OGC:CRS84)
The type DuckDB reports is GEOMETRY('OGC:CRS84'), filled in from a geo entry that has no crs key at all; the specification's default is OGC:CRS84. Ibis's type parser reads anything in those brackets as a geometry subtype and looks it up in a table holding POINT, LINESTRING, POLYGON and the rest. 'OGC:CRS84' is not in that table, and the lookup raises KeyError on exactly that string.
3. The same failure with any CRS
gpd.read_parquet("data/overture-auckland-suburbs-2026-11-18.0.parquet").to_crs(2193).to_parquet("data/suburbs_nztm.parquet")
typ = raw.sql("select typeof(geometry) from 'data/suburbs_nztm.parquet' limit 1").fetchone()[0]
print(f"{typ[:72]}… ({len(typ):,} characters)")
try:
con.read_parquet("data/suburbs_nztm.parquet")
except KeyError as error:
print(f"{type(error).__name__}: {str(error)[:60]}… ({len(str(error)):,} characters)")
GEOMETRY('{"$schema":"https://proj.org/schemas/v0.7/projjson.schema.json… (1,858 characters)
KeyError: '{"$schema":"https://proj.org/schemas/v0.7/projjson.schema.j… (1,848 characters)
Written by GeoPandas in New Zealand Transverse Mercator (EPSG:2193), the same suburbs get a type whose argument is the CRS's whole PROJJSON definition, 1,858 characters, and the KeyError quotes all 1,848 characters of it. So the error is not about OGC:CRS84: any GeoParquet file with a CRS fails the same way, and the message changes with the CRS.
4. Fix it: cast in the query, or read the WKB
cast = con.sql("select * replace (geometry::GEOMETRY as geometry) from 'data/suburbs_nztm.parquet'")
print("cast:", cast.schema()["geometry"], round(cast.geometry.area().sum().execute() / 1e6, 1), "km² of suburbs")
off = ibis.duckdb.connect()
off.raw_sql("set enable_geoparquet_conversion = false")
blob = off.read_parquet("data/suburbs_nztm.parquet")
print("conversion off:", blob.schema()["geometry"])
wkb = blob.mutate(geometry=blob.geometry.cast("geometry"))
print("cast from WKB:", wkb.schema()["geometry"], round(wkb.geometry.area().sum().execute() / 1e6, 1), "km² of suburbs")
cast: geospatial:geometry 656.8 km² of suburbs
conversion off: binary
cast from WKB: geospatial:geometry 656.8 km² of suburbs
Both fixes give a column Ibis can use, and both measure the suburbs at 656.8 km². The first casts in the query. The second switches off DuckDB's GeoParquet conversion for the connection, so read_parquet works and returns the column as raw binary WKB, then casts that to geometry in Ibis. The second keeps read_parquet and its options (hive_partitioning, globs) but affects every file read on that connection.
A helper for every file
The data used on this page
Two GeoParquet files written by DuckDB from Overture Maps 2026-11-18.0 for Auckland, the places and the suburbs, from a saved copy. Places CDLA Permissive 2.0, suburbs ODbL 1.0 (© OpenStreetMap contributors).
import json
from pathlib import Path
import duckdb
import geopandas as gpd
import ibis
import pyarrow.parquet as pq
import requests
Path("data").mkdir(exist_ok=True)
# saved from s3://overturemaps-us-west-2/release/2026-11-18.0/ (theme=places, theme=divisions)
for layer in ["places", "suburbs"]:
name = f"overture-auckland-{layer}-2026-11-18.0.parquet"
if not Path(f"data/{name}").exists():
Path(f"data/{name}").write_bytes(requests.get(f"https://data.spatialworkflow.io/{name}", timeout=300).content)
con = ibis.duckdb.connect()
print("ibis", ibis.__version__, "· duckdb", duckdb.__version__, "· geopandas", gpd.__version__)
ibis 12.0.0 · duckdb 1.5.5 · geopandas 1.1.4
Example 1: a helper that reads any GeoParquet file
def read_geoparquet(con, path, geometry="geometry"):
"""Open a GeoParquet file as an Ibis table whose geometry column Ibis understands."""
return con.sql(f"select * replace ({geometry}::GEOMETRY as {geometry}) from read_parquet('{path}')")
suburbs = read_geoparquet(con, "data/overture-auckland-suburbs-2026-11-18.0.parquet")
largest = (suburbs.mutate(km2=suburbs.geometry.convert("EPSG:4326", "EPSG:2193").area() / 1e6)
.order_by(ibis.desc("km2")).select("name", "km2").limit(3).execute())
print(largest.round(1).to_string(index=False))
name km2
Māngere 25.7
Flat Bush 20.5
Massey 17.7
With the cast in one function, the rest of the code is plain Ibis: project to NZTM2000 with convert, take the area, sort. Māngere, at 25.7 km², is the largest suburb in the box, ahead of Flat Bush (20.5 km²) and Massey (17.7 km²).
Example 2: a table built from the file fails too
con.raw_sql("create table places_tbl as select * from 'data/overture-auckland-places-2026-11-18.0.parquet'")
try:
con.table("places_tbl")
except KeyError as error:
print(f"con.table: {type(error).__name__}: {error}")
con.raw_sql("alter table places_tbl alter geometry type GEOMETRY")
fixed = con.table("places_tbl")
print("after ALTER:", fixed.schema()["geometry"], f"{fixed.count().execute():,} rows")
con.table: KeyError: 'OGC:CRS84'
after ALTER: geospatial:geometry 56,465 rows
Loading the file into a DuckDB table copies the column's type with it, so con.table raises the same KeyError: 'OGC:CRS84'. Altering the column to plain GEOMETRY fixes the table once, for every later session that opens the database, instead of on every read.
Why the cast loses nothing
same = raw.sql("""
load spatial;
select count(*) filter (where ST_AsWKB(geometry) = ST_AsWKB(geometry::GEOMETRY)) as same_bytes,
count(*) as places,
any_value(ST_CRS(geometry)) as crs_before,
any_value(ST_CRS(geometry::GEOMETRY)) as crs_after
from 'data/overture-auckland-places-2026-11-18.0.parquet'
""").fetchone()
print(f"{same[0]:,} of {same[1]:,} geometries byte-identical; CRS before {same[2]}, after {same[3]}")
56,465 of 56,465 geometries byte-identical; CRS before OGC:CRS84, after None
All 56,465 places have the same WKB bytes before and after the cast. ST_CRS reads OGC:CRS84 on the original column and None on the cast one: the label is the only thing removed, and it is removed from the type, not from the file.
Internal links
- Ibis for spatial data explained — what Ibis does with the column once it can read it
- How to read GeoParquet files into Ibis — local files, remote files, and the column this page fixes
- Fixing an Ibis geometry column that arrives as binary — the error you get after switching the conversion off and forgetting the cast
- Fixing Ibis output with no CRS — the CRS the cast drops, put back on the way out
FAQ
Does casting to GEOMETRY change the coordinates?
No. On this page all 56,465 geometries were byte-identical after the cast. Only the CRS label on the column is dropped, and Ibis's DuckDB backend does not use that label anyway.
Why does the error quote a long JSON string?
Because the file has a CRS other than longitude/latitude. DuckDB puts the CRS's full PROJJSON definition in the column type, and Ibis quotes it in the KeyError: 1,848 characters for New Zealand Transverse Mercator.