[Feature]: A mask for tile layers (WMS, XYZ…), as layer.mask gives feature and raster layers

Aperta
#2,530 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust, web-dev

Direzione di ricerca

Start by tracing map.setTiles, map.addTiles, and service.add, then compare how feature and raster layers implement masking. Follow the tile drawing, project save and removal, properties UI, identify, render, and export paths named in the proposal. Done means all listed commands and UI support masks, outside pixels are omitted in view and export, clearing and removing a mask behave as specified, and the tests pass.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Before you start
What problem does this solve?

A tile layer (XYZ, WMS, WMTS, ArcGIS map service) can't be cut to a polygon. layer.mask takes a polygon layer and masks a feature or raster layer, but a tile layer isn't a layer it can be given (map.addTiles and map.setTiles have no mask), so a WMS map of a country or of the world always draws everywhere.

A study area's map then shows the service's picture outside the area too, while every other layer of the area is cut to it. There is no workaround inside RustGIS:

  • A WMS GetMap picture can't be opened as a raster, so it can't be clipped. layer.addUrl on a PNG GetMap address answers "not a data format RustGIS reads".
  • Many services offer no GeoTIFF GetMap, and no WCS of the same product.
Proposed solution

A mask on a tile layer, as feature and raster layers have: the tile layer draws only inside the polygons of a polygon layer.

Choices in this proposal
  • Commands:
    • map.setTiles takes "mask": polygon layer | null, as layer.mask does;
    • map.addTiles and service.add take it too, so a layer can be added already cut.
  • Drawing: the same as layer.mask for a raster, applied to the tile layer's drawn picture: its pixels outside the mask's polygons are left out. Map view, layouts and exports all draw it this way.
  • Saved: the mask is kept in the project with the tile layer, by the mask layer's id, and handled as a feature or raster layer's mask is when that layer is removed.
  • UI: the tile layer's properties get the Masking choice that feature and raster layers have.
  • Identify: a click outside the mask doesn't ask a WMS layer for its feature info.
  • Tests:
    • a tile layer masked by a polygon draws nothing outside it, both in a render and in an export;
    • "mask": null removes the mask;
    • removing the mask layer leaves the tile layer as a raster's mask leaves its layer.
Alternatives considered
  • Veil: a polygon with a hole for the area, drawn over the tiles in the paper's colour. It also hides the basemap and other layers outside the area, and it has to be kept above the tiles by hand.
  • Clip the service's data: only possible where the service offers a GeoTIFF or a WCS, which the drought maps of the Copernicus Global Drought Observatory, for one, don't (their WCS gives colour classes, and not every product).
Additional context

This came up in the BrasilData plugin, which adds the Copernicus Global Drought Observatory's drought maps (WMS) over a study area. Every other BrasilData layer is clipped to the area, and the drought map is not.

Lingua principale
Rust
Stelle
1.9k
Fork
268
Merge medio
11h 1m
PR unite (30g)
942

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di opengeos/RustGIS

Tutte le issue di opengeos/RustGIS

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.