Skip to content

[Feature]: Reload linked data changed on disk #1477

Closed

Description

@deniial00

Before you start

What problem does this solve?

When another program changes a linked dataset, RustGIS should let users reread it without rebuilding the layer's presentation. This implements the roadmap item “Reloading files changed on disk”.

Proposed solution

  • Add Reload Data through layer.reloadData and map.reloadTiles for linked vectors, rasters, editable GeoPackages and local PMTiles/MBTiles archives.
  • On desktop, check file metadata every five seconds and on focus regain, including Shapefile components and SQLite WAL/journal files. Notify after stable observations; never reload automatically.
  • Show Changed on disk, with Reload Data and Not Now. Add manual actions beside source repair in context menus, under Data › Data Source and in Command Search.
  • Preserve identity, styling, labels, order and camera. Validate before replacement; failures must not discard retained data or pending edits. Confirm before discarding GeoPackage edits. Refresh affected caches and prevent stale archive reads from restoring old tiles. Explain that undo cannot restore overwritten files.
  • Folder-backed Zarr/File Geodatabase sources support manual reload only. Detached snapshots and remote/server sources are excluded; local-file actions are unavailable on wasm.

Touches engine, map, UI and, where needed, tiles/data. No new crate, dependency or project-format field. Coordinate with #1440 and #1339.

Verify external edits, preserved presentation, incompatible/missing-source failures, dirty GeoPackage confirmation/undo, archive cache invalidation, companion-file detection, self-saves and stale cross-map results. Run relevant tests and the wasm build, and include screenshots of the actual changed UI.

Estimated scope

Medium: a broader feature that is feasible in a reasonable timeframe

  • PR 1: manual layer reload.
  • PR 2: manual archive reload.
  • PR 3: change detection and notifications.

PRs 1–2 are independent; PR 3 follows both. Keep the roadmap item open until all three land.

Alternatives considered

Removing and re-adding layers loses their presentation. Repair Data Source changes the path rather than rereading it. Automatic reload is not proposed.

Activity

  1. deniial00 commented on Nov 10, 2026

    @deniial00
    MemberAuthor

    Starting on PR 3: change detection and notifications. #1505 (layer.reloadData) and #1504 (map.reloadTiles) are merged, so every reload goes through those two commands. This PR adds no new command, crate, dependency or .rgis field.

    Plan:

    • One shared signature. The archive landing check in repair.rs (FileRevision/ArchiveObservation) moves into a native-only rustgis_engine::observe module. The monitor uses the same one. It records size, modification time and file identity (unix dev/ino/ctime; Windows creation time). SQLite files add -wal and -journal: an empty -wal counts as absent, and -shm is never watched. Shapefiles add exactly the companions the reader opens: lowercase .dbf, .shx and .prj, and all ASCII-case spellings of .cpg. This narrows the plan's "case variants" line. Nothing reads dataset contents.
    • Targets. Linked layers in every map of the project, editable GeoPackages, and local PMTiles/MBTiles archives. GDAL/DuckDB layers are watched at the original file. Zarr and File Geodatabase folders are not monitored: they say so and keep manual Reload Data. Targets reading the same absolute, lexically normalized path are grouped; links are not resolved.
    • Monitor. It lives in rustgis-ui-egui and is desktop only. Scans run every 5 s and when the window regains focus, off the UI thread, one at a time. A change is offered only after two consecutive scans agree. Missing and unreadable files are visible states that clear on a good check. Results are dropped when the project, map, layer instance, archive or path changed.
    • Acknowledgement. A reload acknowledges only the observation that had settled when it was asked, so a write during the reload stays pending. Saves by RustGIS itself (gpkg.saveEdits, export into an existing GeoPackage) are acknowledged once the post-write observation is stable. A change that was already pending stays pending.
    • UI. A persistent, non-modal "Changed on disk" notification lists each affected source. Each map and layer reading it gets its own Reload Data action, which activates that map first and goes through the existing dirty-GeoPackage confirmation. Missing files offer Repair Data Source instead. Not Now dismisses only the current observation, so a newer change notifies again. The Layers pane marks layer and archive rows "(changed on disk)" or "(missing on disk)". Monitor state never dirties the project or adds an undo step.
    • Open choice: the baseline. One option records a runtime-only observation at open, reload and repair. That touches the SourceLayer/RasterLayer/GpkgEdit/archive open paths. The other takes the baseline at the first scan, which runs immediately when a target appears. That leaves the open paths alone but can miss a write between open and that first scan. I'll settle this before touching any open path.
    • Docs and tests. ROADMAP, GEOLIBRE_PARITY and the Reload Data docs get updated, including the limits: metadata-preserving rewrites can evade detection, and manual reload stays available. Tests are a table-driven state machine plus one real-filesystem test per detection family.
  2. Mavrick-F commented on Nov 10, 2026

    @Mavrick-F
    Member

    @deniial00 a small request on the observe module, from #1385 (publishing a layer's edits back to its source file).

    Publish refuses when the source changed since the last sync, so it needs the same file signature you're moving into observe. It needs it for the layers your monitor leaves out on purpose: layers held in memory, whose dataset.source is only history. #1385 would take the signature when such a layer is read, reloaded or published, and save it with the project.

    Two things would let it reuse yours instead of writing a second one:

    Neither changes your plan. I'll start #1385's first PR after PR 3 lands, so we don't touch the same code at once. On the limit you note, rewrites that keep the metadata: publish can also compare a content hash before it writes, so the monitor can stay metadata-only.

  3. Mavrick-F commented on Nov 10, 2026

    @Mavrick-F
    Member

    @deniial00 never mind my request above. #1385 needs a record that stays valid across machines and remounts, so it'll store its own content hashes and won't need anything from observe. Your plan can go ahead unchanged.

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