Skip to content

[Feature]: layer.addUrl reads one box of a remote GeoParquet or FlatGeobuf into an ordinary layer ("bbox"), as it does for a COG #3328

Backlog

Description

@elpidioassinaturas

Before you start

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.run refuses the streamed layer: the clip tool answers "the layer has 8453552 features, more than the 2000000 read at once" (MAX_LIMIT).
  • layer.loadAll would load every feature, past the same limit.
  • Selecting doesn't help a script: in the command line, select.byRect over the area selects nothing on the streamed layer, so select.layerFromSelection answers "nothing is selected in this layer". A streamed layer only holds the last view's features.
  • The other sources already allow it: layer.addUrl with bbox already reads one window of a cloud-optimised GeoTIFF as a raster layer, and overture.add takes bbox for 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.addUrl opens 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: name and zoom. A where would apply the same filter as layer.definitionQuery before the limit is checked, so des_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:

Crates:

  • data: a bounded extent read that returns a Dataset from ParquetSource and the FlatGeobuf source.
  • engine: layer.addUrl with bbox for 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: with where, 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), and gp.run clip 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions