Repository navigation
Description
Before you start
- I searched the existing issues and the roadmap and did not find a duplicate request.
What problem does this solve?
layer.addUrl opens a remote GeoParquet with a bbox covering in place. It reads the file by range, a view at a time, and the GeoParquet source (crates/data/src/source/parquet.rs) prunes row groups by the covering's statistics before decoding anything. That works well for drawing. What it can't do is give a command the features of one area as an ordinary layer, ready for clipping, joins or export.
gp.runrefuses the streamed layer: the clip tool answers "the layer has 8453552 features, more than the 2000000 read at once" (MAX_LIMIT).layer.loadAllwould load every feature, past the same limit.- Selecting doesn't help a script: in the command line,
select.byRectover the area selects nothing on the streamed layer, soselect.layerFromSelectionanswers "nothing is selected in this layer". A streamed layer only holds the last view's features. - The other sources already allow it:
layer.addUrlwithbboxalready reads one window of a cloud-optimised GeoTIFF as a raster layer, andoverture.addtakesbboxfor Overture's GeoParquet. A plain GeoParquet or FlatGeobuf address has no such option.
The case behind this: Brazil's rural property register (CAR, Serviço Florestal Brasileiro). Its official GeoServer (geoserver.car.gov.br) accepts only TLS 1.2 with RSA key exchange; TLS 1.3 and ECDHE are refused. rustls rightly refuses that, so the desktop app can't reach it ("HandshakeFailure").
A national mirror is published as cloud-native GeoParquet on Source Cooperative:
https://data.source.coop/tristangruppwri/cadastral/brazil-car-area-imovel/brazil_car_area_imovel.parquet- 8,453,552 polygons, 16 July 2026, GeoParquet 1.1, 212 row groups, a bbox covering column, 3.26 GB, with CORS and byte ranges.
In the 0.8.0 command line:
layer.addUrlopens it in 13 s, and the municipality of Viçosa (MG) draws correctly in an exported map.- The BrasilData plugin can show it, but it can't give the user "the properties in my area, clipped", which is what the plugin does with every other source.
Proposed solution
layer.addUrl {url, bbox: [west, south, east, north]} on a GeoParquet or FlatGeobuf address reads the features that meet the box into an ordinary in-memory layer, in place of the streamed one.
- One extent query: the source's existing extent query does the work. For GeoParquet that is row-group pruning by the covering statistics, then a row filter by the bbox columns. For FlatGeobuf it is the packed R-tree. Only those ranges are fetched; no new reader is needed.
- Its limit: the box's features count against the limit of what is read at once (
MAX_LIMIT). Past it, the command refuses with the count and asks for a smaller box, instead of returning a sample. - The other options apply as usual:
nameandzoom. Awherewould apply the same filter aslayer.definitionQuerybefore the limit is checked, sodes_condic NOT LIKE 'Cancelado%'doesn't use up room. - The notice: it says what was read, for example "brazil_car_area_imovel: 3,491 features in the box, read by range (3 of 212 row groups)". A file without a covering or index is downloaded whole, as now, and the notice says so.
- Where it works:
- On the desktop and in the command line.
- In the browser too, if the source's range reads are already used there for drawing; otherwise the browser says it needs the desktop, as the COG window does now.
- Plugins: a plugin command run by the desktop app leaves its downloads to the app (
leave_downloads). The window read goes through that same path, with the request numbered as the COG window's is ([Feature]: A plugin command that downloads a layer runs again when it lands, so it can go on with it (clip, rename, style) in the web app and, after #1170, on the desktop #1202).
Choices in this issue:
- Reuse
bbox, not a new command. It already means "a window, as an ordinary layer" for a COG, and plugins already build that call. - Refuse past the limit; don't sample. A clip of a sample would look complete and be wrong.
- Leave out a polygon instead of a box. The box prunes the row groups; the clip by the exact outline is one
gp.runafter it. - Start after fix(data): GeoParquet row groups decode within a byte budget on every read, not only an unbounded view (#2913) #3098 (GeoParquet: enforce decoded byte budget on all read paths #2913). That open PR makes GeoParquet row groups decode within a byte budget on every read. The extent read this issue reuses is in that same file (
crates/data/src/source/parquet.rs), and the window read should take that budget too.
Crates:
data: a bounded extent read that returns aDatasetfromParquetSourceand the FlatGeobuf source.engine:layer.addUrlwithbboxfor these formats, and the notice.
No new dependency.
Testing:
data: a GeoParquet built in the test with three row groups in separate areas and a bbox covering. A box over one of them reads only that group's rows; the count and the fetched ranges are checked.- Limit: a box past a lowered limit refuses with the count.
where: withwhere, only the matching rows are read.- FlatGeobuf: the same box over an indexed FlatGeobuf gives the same features.
engine: the command adds an ordinary layer (not streamed), andgp.runclip works on it.- By hand: the CAR mirror above with Viçosa's box, then the clip by the municipality. For comparison, the official WFS gave 3,491 properties in that box and 2,079 after the clip, through the browser. The mirror is four months older, so its counts may differ a little.
Activity