Skip to content

Smooth panning and zooming with detailed layers: off-thread frames, shape-aware thinning, outline levels #1750

Closed

Description

@giswqs

Panning and zooming a map with a detailed polygon layer feels laggy in the desktop app. Found with the 1:10m worldview borders in #1748 (548k vertices, against 10.6k for the built-in 1:110m countries); QGIS and ArcGIS Pro stay smooth with data that size. This issue tracks three changes, smallest first, each its own PR.

What's measured

The World Atlas sample with the default worldview at the Original detail (#1748), rendered on the CPU path at 1480×900 and 1× pixel density, caches warm, panning a little between frames:

View Simplified (1:110m) Original (1:10m)
World 16 ms 101 ms
Europe 9 ms 52 ms
City 2 ms 10 ms

At world zoom the Original frame splits about evenly: the basemap's world outline about 53 ms, the Countries layer about 47 ms (fills ~25, strokes ~15, labels ~8).

Why it lags

  1. The exact frame is drawn on the UI thread. crates/ui-egui/src/mapview.rs already shows the last frame shifted and scaled during a pan or zoom, but about 0.18 s after the motion stops it draws the exact frame synchronously (rustgis_engine::render::render), so the window freezes for the whole render. Scroll-wheel zooming stops and starts often, so it hits that freeze repeatedly. On a 2× display the frame has four times the pixels.
  2. Thinning keeps too much of a detailed coastline. crates/map/src/lod.rs keeps a vertex once it's about a device pixel from the last one kept (distance thinning, [Feature]: Thin geometry to about a pixel, before projecting it #1066). On 1:10m borders that keeps 194k of 548k vertices at world zoom and 373k for Europe. Douglas–Peucker at the same tolerance keeps 26k and 92k (measured with Shapely on the same data).
  3. The basemap's world outline has no levels of detail. Every basemap draws the land outline (world() in crates/render/src/lib.rs) from the full countries geometry each frame. It's culled per country only, so Russia's whole outline is walked even zoomed in on Europe. With a detailed worldview, the outline alone costs as much as the Countries layer.

How QGIS and ArcGIS Pro avoid it

  • Drawing off the UI thread: QGIS renders in cancellable background jobs (QgsMapRendererParallelJob), shows the previous image while one runs, and keeps a per-layer image cache. ArcGIS Pro draws asynchronously and multi-threaded, with a local display cache.
  • Simplifying for display: QGIS simplifies on the fly by default (1 px threshold; distance, snap-to-grid or Visvalingam). ArcGIS Pro and feature services generalize per zoom (quantization, maximum allowable offset).
  • GPU drawing: ArcGIS Pro keeps features on the GPU, so panning moves the camera instead of redrawing. RustGIS's GPU backend (beta) works this way but isn't the default path.
  • Pre-generalized basemaps: both use tiles simplified per zoom level, never raw 1:10m borders at world zoom.

Plan

Related: #1066 (1 px distance thinning), #1067 (drawing a heavy layer on several cores), #1748 (worldviews at original detail).

Activity

  1. added 20 commits that reference this issue on Nov 11, 2026
  2. giswqs commented on Nov 11, 2026

    @giswqs
    MemberAuthor

    Done in three PRs: #1769 (world outline levels of detail, the 1:10m outline at world zoom 52 to 17 ms), #1774 (Douglas–Peucker display thinning, the 1:10m Countries layer 48 to 27 ms at world zoom), #1775 (a flat map's settled frame drawn on a worker and stopped when the map moves again; the longest UI frame after a pan went from 30 to 51 ms to under 2.5 ms). With the 1:10m worldview the whole world frame is 43 ms against 102 ms before (CPU, 1480×900).

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions