Skip to content

[Bug]: A plugin's layer.addUrl freezes the desktop window and reads only the first page of an ArcGIS query #1144

Closed

Description

@jgregoriorincon

Before you start

  • I searched the existing issues and did not find a duplicate.
  • This is a bug report, not a usage question (questions belong in Discussions).

What happened?

In the desktop app, a plugin command that adds data from the web with layer.addUrl has two problems that Home › Add › From Service doesn't have.

  1. The window freezes until the download ends. layer.addUrl downloads on the window's thread (download_blocking / open_url_blocking in crates/engine/src/cmd/layer.rs), so the window doesn't repaint: there is no "Downloading…" notice and no click registers. With a slow server this lasts minutes, and RustGIS looks hung. The From Service dialog downloads the same layer off the frame (ui.addUrl, crates/ui-egui/src/serviceui.rs:90) and says "Downloading…". The web app does that for plugins too: layer.addUrl answers {"pending": true} (Session::request_url) and the layer is added when it lands.
  2. An ArcGIS query stops at the server's record limit. ogc::read_pages reads an ArcGIS …/query that hit its limit (exceededTransferLimit) again in pages, up to 100,000 features, but only on the dialog's path, where ui.addUrl gets "service": true (and in service.add). A plugin gets the first page (often 1,000 or 2,000 features), so a catalogue plugin's layer comes in incomplete, and the plugin can only tell the user to zoom in and add it again.

Steps to reproduce

  1. Load a WebAssembly plugin whose command runs host::run("layer.addUrl", json!({"url": URL, "name": "Lotes", "zoom": false})), with URL the sample data below: an ArcGIS query of Bogotá's cadastral parcels in a few blocks of the centre. The box holds 10,076 parcels (returnCountOnly), and the server gives 2,000 at once (maxRecordCount, supportsPagination: true).
  2. Run the command in the desktop app. While it downloads, the window doesn't respond and nothing says that something is downloading.
  3. When it ends, the layer has 2,000 features: the first page, which says exceededTransferLimit: true.

The same through the engine, with rustgis-cli on main:

  • layer.addUrl={"url": URL, "name": "Lotes", "zoom": false} gives "features": 2000.
  • service.add={"url": "https://serviciosgis.catastrobogota.gov.co/arcgis/rest/services/catastro/lote/MapServer", "layer": "0", "bbox": [-74.0802, 4.6175, -74.0577, 4.6354]} gives "features": 8186, the whole box (8,184 counted), read page by page.

Expected behavior

A plugin's layer.addUrl behaves in the desktop app as the From Service dialog's download does:

  • It downloads off the frame. The command answers {"pending": true, "url": ...}, as in the web app, "Downloading…" shows, and the layer is added when it lands. Plugins already handle that answer, since the web app gives it. One way to get there: a session flag the desktop UI sets, so that layer.addUrl from a plugin command goes through Session::request_url. The UI already takes those requests every frame and runs ui.addUrl. rustgis-cli, gp.run and scripts keep waiting for the layer, as they need.
  • An ArcGIS …/query is read past the server's record limit in pages, up to MAX_PAGED_FEATURES, as the dialog's is. That could happen whenever the address is an ArcGIS query that doesn't ask for a window of its own (no resultOffset / resultRecordCount), or with "service": true documented as a layer.addUrl parameter.

How are you running RustGIS?

Desktop app

Version

main (7bf2e20)

Operating system, browser and graphics

Linux (Fedora 44 Kinoite / Bazzite)

Sample data

https://serviciosgis.catastrobogota.gov.co/arcgis/rest/services/catastro/lote/MapServer/0/query?where=1%3D1&outFields=*&returnGeometry=true&outSR=4326&f=geojson&geometry=-8246500,515500,-8244000,517500&geometryType=esriGeometryEnvelope&inSR=3857&spatialRel=esriSpatialRelIntersects

Screenshots or logs

No response

Activity

  1. added
    bug
    on Oct 29, 2026
  2. jgregoriorincon commented on Oct 29, 2026

    @jgregoriorincon
    ContributorAuthor

    I'd like to take this one.

    Plan, in two steps, one pull request each:

    1. Off the frame. The desktop UI sets a session flag, and layer.addUrl run from a plugin command goes through Session::request_url, as in the web app. The command answers {"pending": true}, "Downloading…" shows, and the layer is added when it lands. rustgis-cli, gp.run and scripts keep waiting for the layer as today.
    2. Pages. An ArcGIS …/query that hits the server's record limit is read in pages (ogc::read_pages, up to MAX_PAGED_FEATURES), as the From Service dialog reads it.

    One question before step 2. Should every ArcGIS query that doesn't ask for a window of its own (no resultOffset / resultRecordCount) be read in pages, or only when the caller asks with "service": true, documented as a layer.addUrl parameter? Paging every such query changes what layer.addUrl gives scripts today (more than the first page). The flag keeps today's answer unless asked. I'd lean to the flag, unless you prefer pages by default.

  3. jgregoriorincon commented on Nov 15, 2026

    @jgregoriorincon
    ContributorAuthor

    An update on what's left here.

    What's left is the engine's path: rustgis-cli, scripts and tasks. There layer.addUrl with "service": true still downloads the address once, so an ArcGIS query gives its first page only (2,000 of Manzana's 44,529 blocks, say), with RustGIS's single symbol. service.add already reads the whole layer on that path, through service::download_layer.

    I'll close it with one small pull request: that branch of service.add becomes a shared function, which layer.addUrl with "service": true uses too when there is no app to leave the download to. A test adds a paged ArcGIS query through layer.addUrl on a session without the app and counts every page's features.

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions