How to Read GeoParquet Files into Ibis, Local or Remote
On this page
Problem statement
GeoParquet is the format Ibis and DuckDB read best: the columns are stored separately, so a query that needs three columns reads three, and over HTTP that means fetching only those parts of the file. Getting a GeoParquet file into Ibis with its geometry usable takes more than con.read_parquet on Ibis 12 and DuckDB 1.5, though, and so does a GeoPackage through read_geo. This page reads Overture Maps buildings and suburbs for Auckland from a local copy and straight from a web server. It measures how many bytes each query downloads, and shows the one-line read that works for every case.
Quick answer
Read through con.sql with the geometry cast to plain GEOMETRY. The same line works for a path or a URL:
def read_geoparquet(con, source, geometry="geometry"):
return con.sql(f"select * replace ({geometry}::GEOMETRY as {geometry}) from read_parquet('{source}')")
remote = read_geoparquet(con, URL)
print(f"{remote.count().execute():,} buildings, read from {URL.split('/')[2]}")
623,445 buildings, read from data.spatialworkflow.io
The function wraps DuckDB's read_parquet in a query that casts the geometry column, and returns an ordinary Ibis table. Given a URL, DuckDB reads the file over HTTP with range requests. The 623,445 buildings are counted without downloading the 80 MB file.
Reading only what the query needs
1. The two readers that fail
for label, call in [("read_parquet", lambda: con.read_parquet("data/overture-auckland-suburbs-2026-11-18.0.parquet")),
("read_geo (GeoPackage)", lambda: con.read_geo("data/suburbs.gpkg"))]:
try:
call()
except KeyError as error:
print(f"{label:22} KeyError: {error}")
read_parquet KeyError: 'OGC:CRS84'
read_geo (GeoPackage) KeyError: 'OGC:CRS84'
Both of Ibis's own readers stop at the schema with the same KeyError, read_geo included: ST_Read gives the GeoPackage's geometry the same CRS-qualified type (the error explained).
2. Count the bytes each query fetches
con.raw_sql("CALL enable_logging('HTTP')")
def fetched(run):
"""Run a query and report the HTTP GET requests DuckDB made and the bytes they returned."""
con.raw_sql("CALL truncate_duckdb_logs()")
value = run()
n, size = con.raw_sql("""select count(*), coalesce(sum(try_cast(response.headers['Content-Length'] as bigint)), 0)
from duckdb_logs_parsed('HTTP') where request.type = 'GET'""").fetchone()
return value, n, size
size_mb = int(requests.head(URL, timeout=60).headers["Content-Length"]) / 1e6
for label, run in [("count rows", lambda: remote.count().execute()),
("buildings with a height", lambda: remote.filter(_.height.notnull()).count().execute()),
("total footprint area", lambda: remote.geometry.convert("EPSG:4326", "EPSG:2193").area().sum().execute())]:
value, n, size = fetched(run)
print(f"{label:24} {value:>14,.0f} {n} GET requests, {size / 1e3:9,.1f} kB of {size_mb:.1f} MB")
count rows 623,445 0 GET requests, 0.0 kB of 80.0 MB
buildings with a height 360 6 GET requests, 2.5 kB of 80.0 MB
total footprint area 107,769,514 6 GET requests, 67,450.6 kB of 80.0 MB
DuckDB's HTTP log shows what each query cost. Counting rows made no requests at all: the count is in the file's footer, which DuckDB had already fetched when Ibis asked for the schema. Counting the 360 buildings with a height fetched 2.5 kB in 6 requests, because only the height column was read, and it is almost all nulls. The total footprint area, 107.8 kmΒ², needed every geometry, and fetched 67.5 MB of the 80.0 MB, all of the geometry column and none of the others.
3. A GeoPackage or shapefile through ST_Read
con.load_extension("spatial") # ST_Read is SQL you write, so Ibis does not load the extension for it
gpkg = con.sql("select * replace (geom::GEOMETRY as geom) from ST_Read('data/suburbs.gpkg')")
print(gpkg.schema()["geom"], f"{gpkg.count().execute()} suburbs from the GeoPackage")
geospatial:geometry 167 suburbs from the GeoPackage
For formats GDAL reads, a GeoPackage here or a shapefile, ST_Read inside con.sql replaces read_geo, with the same cast on its geom column. It is SQL you write, so the spatial extension has to be loaded first; Ibis loads it only for its own geometry methods.
4. Several files as one table
Path("data/halves").mkdir(exist_ok=True)
for part in ["north", "south"]:
cond = "ST_Y(ST_Centroid(geometry)) > -36.9" if part == "north" else "ST_Y(ST_Centroid(geometry)) <= -36.9"
con.raw_sql(f"""copy (select * from 'data/overture-auckland-suburbs-2026-11-18.0.parquet' where {cond})
to 'data/halves/suburbs_{part}.parquet'""")
both = con.sql("""select * replace (geometry::GEOMETRY as geometry)
from read_parquet('data/halves/*.parquet', filename = true, union_by_name = true)""")
print(both.group_by("filename").aggregate(n=_.count()).order_by("filename").execute().to_string(index=False))
filename n
data/halves/suburbs_north.parquet 100
data/halves/suburbs_south.parquet 67
A glob reads many files as one table, and filename = true adds the file each row came from: 100 suburbs from the northern file and 67 from the southern. union_by_name = true matches columns by name, so files written at different times with columns in a different order still line up. The same options work with a URL to a folder of files on S3, where DuckDB can list the objects; plain HTTP servers cannot be listed, so there each file needs its own URL.
Local copy against remote file
The data used on this page
An 80 MB file of 623,445 Overture Maps building footprints and a 4 MB file of 167 suburbs, Auckland, release 2026-11-18.0, served from data.spatialworkflow.io, a plain HTTPS server; ODbL 1.0, Β© OpenStreetMap contributors, Overture Maps Foundation.
from pathlib import Path
import geopandas as gpd
import ibis
import requests
from ibis import _
Path("data").mkdir(exist_ok=True)
BASE = "https://data.spatialworkflow.io/"
URL = BASE + "overture-auckland-buildings-2026-11-18.0.parquet" # 80 MB; the page reads it remotely, then locally
for name in ["overture-auckland-suburbs-2026-11-18.0.parquet", "overture-auckland-buildings-2026-11-18.0.parquet"]:
if not Path(f"data/{name}").exists():
with requests.get(BASE + name, stream=True, timeout=600) as r:
r.raise_for_status()
with open(f"data/{name}", "wb") as f:
for chunk in r.iter_content(1 << 20):
f.write(chunk)
gpd.read_parquet("data/overture-auckland-suburbs-2026-11-18.0.parquet").to_file("data/suburbs.gpkg") # a GeoPackage to read in step 3
con = ibis.duckdb.connect()
print("ibis", ibis.__version__)
ibis 12.0.0
Example 1: the same query on the local copy
local = read_geoparquet(con, "data/overture-auckland-buildings-2026-11-18.0.parquet")
expr = lambda t: t.group_by("source").aggregate(n=_.count()).order_by(ibis.desc("n"))
a, b = expr(local).execute(), expr(remote).execute()
print(a.to_string(index=False))
print("local and remote agree:", a.equals(b))
source n
OpenStreetMap 560666
Esri Community Maps 62779
local and remote agree: True
Grouped by source, 560,666 of the buildings come from OpenStreetMap and 62,779 from Esri Community Maps, and the local and remote reads return exactly the same table. Only the I/O differs. A query that reads few columns, or few row groups, is cheap remotely too; one that reads every geometry costs about the file's size either way.
Why most queries download a fraction
A Parquet file is split into row groups, and each row group into column chunks, with the location and statistics of every chunk in a footer at the end of the file. DuckDB reads the footer first, then fetches only the byte ranges of the chunks a query needs. It skips row groups whose statistics show they cannot match a filter. An Ibis expression decides what that query is: select, filter and aggregates compile into SQL that names only the columns used, so DuckDB never asks for the rest. That is why the expression, not the file, sets the cost. Counting is free, one mostly empty column costs kilobytes, and the geometry, the widest column, is most of the file.
When the remote read is slow
- Every geometry is most of the file. Any spatial predicate over all rows reads the whole geometry column, 67.5 MB here. Filter on cheap columns first, or on a
bboxcolumn if the file has one (Overture's own files do), so whole row groups are skipped. - Unordered files skip nothing. Row-group statistics help only if similar values sit together. A file written in Hilbert order (how) lets a bounding-box filter skip most of it; one in id order does not.
- Servers without range requests. Reading part of a file depends on the server honouring HTTP
Rangeheaders. Object stores and most static file servers do; check an unfamiliar server with one small query and the HTTP log, as in step 2. - Repeated reads. Each new connection fetches the footer again. Keep one connection for a session, or download a file you will scan in full more than once.
Internal links
- Fixing KeyError: 'OGC:CRS84' when Ibis reads GeoParquet β why the cast is in every read
- How to query remote Parquet with DuckDB β the same range requests from SQL, with timings on Overture's own bucket
- Fixing an Ibis geometry column that arrives as binary β Parquet files that are not GeoParquet
- Ibis for spatial data explained β why the expression decides what is read
FAQ
Can Ibis read Overture's files on S3 directly?
Yes. Pass s3://overturemaps-us-west-2/release/<release>/theme=buildings/type=building/* to the same function, with the bucket's region set (con.raw_sql("set s3_region = 'us-west-2'")). Overture deletes old releases, so code that must give the same answer later should read a copy, as this page does.
Is reading remotely slower than reading locally?
For a query that reads little, no: the requests are few and small. For one that reads the whole geometry column, it costs a download of most of the file every time; download it once if you will do that repeatedly.