[Feature]: A credit on every layer, listed as a publication layout's sources when none are given

Open
#2,494 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
backend, databases

Research direction

Start with crates/engine/src/cmd/layout.rs around line 1223 and ribbon.rs around line 1108, then trace rustgis_map::Layer and how layer data and project state are saved. The issue also calls out layer.addData, layer.credit, Layer Properties, file metadata, and layer-producing tools as entry points. Done means credits survive those paths and Publication Layout uses visible layer credits by default, with the specified overrides and warning; the listed tests should cover these cases.

Written by the indexing model from the issue text.

Description

Before you start
What problem does this solve?

A map sheet must say where its data came from. layout.publication has a sources parameter, but when it isn't given the sheet has no sources at all (crates/engine/src/cmd/layout.rs:1223, texts_of(p, "sources")?.unwrap_or_default()). The footer then shows only the cartographic reference. The New Layout menu runs layout.publication with no sources (ribbon.rs ~1108), and nothing could fill them in, because RustGIS has nowhere to keep them:

  • Tile layers have an attribution, which the map draws as a credit.
  • A cube catalog entry has a credit (JAXA Earth datasets: "JAXA, "), and it is passed to stac.addCube as the cube layer's attribution.
  • A raster or vector layer (rustgis_map::Layer) has no such field. So the layer that cube.reduce makes from a JAXA cube, a GeoTIFF or a shapefile opened with layer.addData, and a layer made by a tool or a plugin all lose where they came from.

The user has to retype the sources for every layout, and a sheet made in one click goes out without them.

Proposed solution

A credit on every layer: one line of text saying where its data came from. Publication Layout lists the credits of the visible layers as the sheet's sources when none are given.

Choices in this proposal
  • Field: credit: String on Layer, empty by default, saved in the project. An older project opens with all credits empty.
  • Setting it:
    • a "credit" parameter on layer.addData;
    • a new layer.credit {"layer", "credit"} command, which plugins and scripts can call;
    • a Credit field in Layer Properties (General or Source tab).
  • Filled in automatically:
    • A tile layer's credit is its attribution, so nothing new is stored for it.
    • A file whose metadata names its source (a GeoTIFF's TIFFTAG_COPYRIGHT, a GeoPackage's or a STAC item's attribution) gets that as its credit.
    • A layer made from another one (clip, reproject, resample, cube.reduce, raster calculator, vector tools) gets its input's credit. With several inputs, it gets their distinct credits joined with "; ".
  • Publication Layout:
    • When "sources" isn't given, the sources are the distinct credits of the visible layers, top to bottom, with basemap attributions last.
    • "sources": [] still gives none, and given sources are used as they are.
    • When a visible data layer has no credit, a warning names it, so the user knows the sheet doesn't say where it came from.
    • The New Layout menu gets the same sources this way. The sources stay an ordinary text element on the sheet, which the user can edit.
  • Tests:
    • layer.addData with a credit, then layout.publication without sources, lists it;
    • cube.reduce from a catalog cube keeps the entry's credit;
    • a layer with no credit gives the warning;
    • "sources": [] gives no sources.
Alternatives considered
  • Sources in the layer's name: this makes long names, which the legend and the colorbar then show.
  • Leaving it to plugins: the BrasilData plugin keeps its own sources table and passes sources to layout.publication itself. Every plugin and script would have to do the same, and data opened by hand would still have none.
Additional context

This came up when a user ran Publication Layout on monthly rainfall from JAXA Earth: the sheet came out with no sources. JAXA's terms ask for a credit on maps using their data, and the cube catalog already knows it.

Dominant language
Rust
Stars
1.9k
Forks
268
Avg merge
11h 1m
Merged PRs (30d)
942

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from opengeos/RustGIS

All issues in opengeos/RustGIS

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.