Docs
Contents

Query without downloading

This is what actually changes how you work with these data.

Every file is GeoParquet 1.1 with a bbox covering declared in its metadata, ordered along a Hilbert curve. In plain terms: records near each other live together in the file, each block declares its own rectangle, and a reader that understands that skips the blocks it does not need.

The query

import duckdb
con = duckdb.connect()
con.execute("INSTALL spatial; LOAD spatial; INSTALL httpfs; LOAD httpfs;")
url = "<signed-url>" # from /datasets/{id}/download
con.execute(f"""
SELECT count(*) FROM read_parquet('{url}')
WHERE bbox.xmax >= 24.55 AND bbox.xmin <= 24.95
AND bbox.ymax >= 59.35 AND bbox.ymin <= 59.52
""").fetchone()
(61815,)

61,815 parcels in the Tallinn area, in 1.3 seconds, over a 143.8 MB file that stays on the server.

How much it saves, measured

LayerSizeBytes read for an area query
ee_cadastral_parcelas143.8 MB14.5%
ee_territorial_mullakaart827.2 MB2.2%

The predicate must be on bbox

This prunes:

WHERE bbox.xmax >= 24.55 AND bbox.xmin <= 24.95

This does not, and downloads the whole file:

WHERE ST_Intersects(geometry, ST_MakeEnvelope(24.55, 59.35, 24.95, 59.52))

The bbox column carries per-block statistics; the geometry does not. Filter on bbox first and refine with the geometry afterwards if you need exactness:

SELECT * FROM read_parquet('...')
WHERE bbox.xmax >= 24.55 AND bbox.xmin <= 24.95
AND bbox.ymax >= 59.35 AND bbox.ymin <= 59.52
AND ST_Intersects(geometry, ST_MakeEnvelope(24.55, 59.35, 24.95, 59.52))

With GeoPandas

GeoPandas uses the covering too, but on a file on disk:

import geopandas as gpd
gdf = gpd.read_parquet("parcels.parquet", bbox=(24.55, 59.35, 24.95, 59.52))
# 61,815 rows in 0.14 s, without reading all 143.8 MB

If a file did not declare the covering, read_parquet(..., bbox=) would raise ValueError rather than run slowly. All of ours declare it.