Skip to content

[Feature]: Planetary (IAU) coordinate reference systems #1448

Open

Description

@PawelKra

What problem does this solve?

#223 asked for planetary CRS support, and #505 added celestial bodies to the map. #505 deferred four things: IAU_2015 codes (with WKT2), sinusoidal and orthographic, reading the body from a layer's CRS, and a warning when layers from different bodies share a map. This issue proposes doing them in small steps, and asks about a few decisions first.

Planetary data mostly loads today, in the right place, but by accident. A Mars datum has no
+towgs84, so proj4rs sees "no datum" and skips the shift, and the body's lon/lat pass through the
WGS 84 hub unchanged. Nothing in RustGIS knows the data is on Mars. I tried files written by
GDAL/PROJ for the IAU_2015 codes of Mars and checked the results:

  • A geographic Mars GeoTIFF is labelled EPSG:4326, with no notice (raster.info, Details
    pane). Its GeoKeys are user-defined with a Mars radius; the reader only handles that for projected
    models. The same hole hits Earth GCSs on non-WGS 84 ellipsoids.
  • West-positive longitudes are read as east-positive. A planetographic WKT2 .prj with a west
    axis puts Olympus Mons (133.8°W) at 133.8°E, with no notice. Planetographic latitude is also left
    unconverted.
  • The datum notice is wrong. Every Mars .prj says "the datum … has no conversion to WGS 84 … a
    few hundred metres off". There is no WGS 84 involved, and 0–360 longitudes get a "may draw out of
    place" note instead of being normalised.
  • GeoPackage, FlatGeobuf, GeoParquet and GeoJSON in an IAU CRS are read as degrees. A GeoPackage
    in Mars equirectangular metres gets an extent of about ±8 000 000 "degrees", with only a "no EPSG
    code" notice. An unusable result should be an error.
  • Exports are written as WGS 84. Mars data to GeoPackage or GeoJSON has no body and says
    EPSG:4326. A Shapefile .prj keeps the radius but loses the body name and the west axis, and
    GDAL can't identify it. A Mars GeoTIFF read through geographic keys is written as GEOGCS["WGS 84"…].
  • Four projection families aren't read from a .prj: Sinusoidal, Robinson, Orthographic and
    Mercator Variant A. They get a notice and are read as lon/lat. Earth files are refused too (MODIS
    sinusoidal shapefiles, for example).
  • The map stays on Earth whatever the layer is, so a rendered Mars raster shows an Earth scale
    bar.

What works today: projected Mars shapefiles and GeoTIFFs (equirectangular, polar stereographic,
Mollweide), for the reason above.

Under the "Never silent" rule these are bugs, not missing features.

Proposed solution

No new dependency. proj4rs 0.3 has what IAU codes need: +R, +a/+b, +geoc (planetographic
to planetocentric), +axis=wnu, stere, ortho, moll, robin, merc, tmerc, lcc, laea,
aea; sinu is already in rustgis-geom. I checked each against PROJ values. The one gap is
eqc, which proj4rs forces to a sphere. That also makes Earth's EPSG:4087 about 24 km off at 45°N,
and it affects the ellipsoidal IAU equirectangular codes.

A built-in IAU_2015 table, derived from the IAU WGCCRE report (Archinal et al. 2018,
doi:10.1007/s10569-017-9805-5), with the code scheme (NAIF id × 100 + offset). It would be one row
per body, with radii and rotation sense cited, plus a builder for the sphere, the two ellipsoid
flavours and the projections. It is not copied from PROJ's database. A PROJ-generated corpus would
only provide test expectations.

The map's drawing stays as it is. Coordinates stay degrees and Web Mercator stays a sphere
scaled by the body's radius, which is what the planetary basemaps use. Support lives in the data
layer, plus an engine check of a layer's body against map.body. A layer's lon/lat would mean "the
body's planetocentric, east-positive lon/lat", which on Earth is unchanged.

Staged plan

Each PR stands alone and keeps cargo xtask ci and the wasm build green.

PR Scope Size Depends on
1 Missing projection methods in .prj and GeoKey readers (Sinusoidal, Robinson, Orthographic, Mercator A) and an ellipsoidal equidistant cylindrical S nothing
2 IAU table, Crs::parse and WKT reading of IAU codes, Crs::body(), no WGS 84 datum note for planetary CRSs, the 11 planetary ESRI codes M nothing
3 Read the CRS from every format (GeoTIFF user-defined geographic keys, GeoPackage, FlatGeobuf, GeoParquet, GeoJSON crs); unreadable CRS is an error; show CRS and body in Details and raster.info M 2
4 Longitude and latitude conventions: body hub in the transformer, west-positive, planetographic, 0–360, one notice per kind M 2
5 Body-aware maps: refuse or follow a layer's body, map.body check, IAU codes in map.projection, warp refuses another body M–L 2, 3 (4 for planetographic data)
6 Write planetary CRSs on export (Shapefile, GeoPackage, FlatGeobuf, GeoParquet, GeoTIFF); notice for GeoJSON/KML/GPX M 2 (3 for round trips)

Tests would go through the real readers with GDAL-written fixtures, in both directions (lossy input
gives the notice, clean input none), with Earth files keeping their current behaviour.

Needs your agreement first

  • The Dataset rule "geometry is always WGS 84 longitude/latitude" (data/src/lib.rs) would become
    "the body's planetocentric lon/lat". Plugins and tools rely on it.
  • Storing a CRS's body: either keep Crs::Custom with a canonical label (no .rgis change, body
    re-derived on load), or add a Crs::Iau(u32) variant and SavedCrs::Iau (a project-format
    change).
  • Behaviour changes to existing commands (PR 5): layer.add* could move an empty Earth map to the
    layer's body, or refuse a layer on another body; map.body could refuse or warn when layers of
    another body are loaded; map.projection would accept IAU codes.
  • The ROADMAP "Correct coordinates" item (coordinate first) owns the datum-shift notices that PRs 2
    and 6 touch.

Open questions

  1. Canonical lon/lat off Earth: planetocentric, east-positive, −180…180, or keep what the file
    has?
  2. A layer on another body: refuse, or warn and draw? For an empty Earth map, move to the body
    automatically (with a notice and undo), or only offer?
  3. Which bodies get CRSs: only the 12 in BODIES, or all of IAU 2015 as CRS-only (readable but
    not placeable until BODIES grows)?
  4. Body radii: some BODIES values differ from the IAU 2015 ones (Mercury, Io, Titan, by up to
    0.05%). Update them and add NAIF ids? Matching a file's body would be by code or name first, by
    radius only within a tolerance.
  5. GeoJSON export of planetary data: plain RFC 7946 with a notice, or a legacy crs member that
    GDAL reads?
  6. CRS-less data on a non-Earth map: take it as the map's body with a notice, or require a CRS?

PR 1 stands on its own

PR 1 needs no agreement. It adds projection methods that are missing and an ellipsoidal equidistant
cylindrical (computed in rustgis-geom from Snyder's USGS PP 1395, like Sinusoidal), and it fixes
Earth files (MODIS sinusoidal, Robinson, EPSG:4087). I intend to open it first.

Alternatives considered

  • Vendoring PROJ's iau.sql: its licence allows it, but a table built from the report is smaller
    and has no data to keep in sync.
  • Leaving the map as is and only fixing labels: this still writes Mars data as WGS 84 and can't
    catch mixed bodies.

@thareUSGS offered help in #223 and pointed at the IAU_2015 registry. If you have time, a look at
the body table (radii, rotation sense, code scheme) would be very welcome.

Activity

  1. Mavrick-F commented on Nov 5, 2026

    @Mavrick-F
    Member

    Thank you, this is a thorough audit. Several items on that list (a Mars GeoTIFF labelled EPSG:4326, west-positive longitudes read as east, projected metres read as degrees) are silent losses, so they're bugs under our rules whatever we decide about the rest.

    PR 1 needs no agreement. The missing .prj/GeoKey projection methods and the ellipsoidal equidistant cylindrical also fix Earth files, so please go ahead. A small early PR that only reports the planetary cases (a notice, or an error where the result is unusable) would be welcome too, before any model change.

    PRs 2–6 change what Dataset coordinates mean, so they need @giswqs's sign-off before much code is written. To give that discussion a starting point, here are my own leanings:

    • Canonical lon/lat: planetocentric, east-positive, −180…180, which is what the basemaps already assume.
    • Storage: Crs::Custom with a canonical label, which avoids a project-format change.
    • A layer on another body: an empty Earth map follows the layer's body, with a notice and undo. A map already on a different body refuses the layer with an error rather than drawing it in the wrong place.
    • Bodies: CRSs only for the bodies in BODIES at first. Update the radii to the IAU 2015 values and add NAIF ids.
    • GeoJSON export: plain RFC 7946 with a notice.
    • CRS-less data on a non-Earth map: take it as the map's body, with a notice.

    The datum-notice changes overlap the roadmap's "Correct coordinates" item, so please link that item when you get there.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions