[Enhancement]: geodesic stand-point

Open
#2,568 1 comment 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
8/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Active
Tech stack
rust
Domain
data

Research direction

The payload is a long critical review that asks for many design changes, not one bounded fix. The files it names include crates/data/src/lib.rs (Z and M dropped on import), crates/geom/src/lib.rs (the analysis plane), reproject.rs and wkt.rs. Nothing here is a narrow, testable change yet. A workable first step would be to split one request, such as lossless Z and M storage, into its own issue with a named test and an agreed scope. Done means a maintainer has accepted that scope.

Written by the indexing model from the issue text.

Description

enhancement
Before you start
What problem does this solve?

Some minor to major improvementy to the underlyung idea

Proposed solution

Summary
This is a critical review of RustGIS as of commit e4cc3ae. It looks at the project from two angles: geodesy and geoinformatics (reference systems, datums, edge semantics, measurement, heights) and designing, maintaining and providing a GIS (reviewability, governance, verification, stability, documentation).

The method was to read the code and docs and then check the numbers against PROJ 9.8.1 (pyproj 3.8) and GeographicLib. The scripts are at the end so anyone can rerun them. Wherever possible, findings quote the project's own docs and tests.

Some things are already done well, and this review builds on them. The ellipsoidal measurements use GeographicLib. UTM uses Karney's (2011) 6th-order Krüger series and follows NGA's rules for the Norway/Svalbard and UPS exceptions. Buffers are geodesic, made in local AEQD pieces. WMS/WMTS axis order is handled. Test values are checked against cs2cs. The "never silent" rule means losses are reported in notices. And #2032 already plans per-layer native CRS. The points below are either not covered by #2032 / #726, or they are covered but their geodetic consequences aren't stated there.

A. Geodesy and geoinformatics
A1. Storage CRS: everything is converted to "WGS 84" through a hub, and those derived coordinates are saved
Vector geometry is stored as WGS 84 lon/lat (crates/data/src/lib.rs#L3), and projects save features in lon/lat (lib.rs#L433-L437). So the master copy of the data is the result of a datum transformation, not the source coordinates.
EPSG:4326 is a datum ensemble with about 2 m accuracy. ETRS89, NAD83, GDA2020, RDN2008 and IGM95 data are all relabelled "WGS 84", by null or ballpark operations (docs/user-guide/data.md#L269). In 2026, ETRS89 (ETRF2000) and ITRF2020/WGS 84 (G2296) differ by about 0.9 m in Central Europe. A coordinate labelled "WGS 84" that is really ETRS89 is a latent error as soon as it is combined with GNSS/ITRF data.
The repo's own test shows what the hub costs: DHDN / GK zone 3 → ETRS89 / UTM 32N via WGS 84 is 0.44 m away from PROJ's direct operation (reproject.rs#L232). #2032 B3 adds the direct operation, but it says itself: "Nothing changes today, since every layer is in lon/lat". Raster warping also still goes "through each system's transformation to WGS 84" (analysis.md#L1918).
Results depend on the machine's state. Grids are optional and downloaded in the background, and "A layer opened before keeps its places until it is opened again" (maps.md#L738-L739). Because the transformed coordinates are saved, a project freezes whichever transformation happened to be available at import: Helmert fallback or grid, which is "up to about 10 m" for NAD27 by your docs. Exporting later with a grid that has arrived in the meantime can then apply an asymmetric round trip. (This last point needs a test to confirm; it follows from transformers being rebuilt per grid generation.)
Requests: finish #2032 C2c (native storage) with high priority. Until then, never treat the lon/lat copy as the master. Save the source coordinates, or at least the operation that was used: its EPSG operation code, its accuracy, and whether the grid was present. Show that per layer.

A2. Edge semantics are inconsistent (the main geodetic flaw)
One polygon is read in up to four different ways, depending on which part of RustGIS touches it:

Component What an edge between two vertices means
Source data (UTM, GK, LAEA, …) straight line in the source projection
Overlays, Clip/Intersect/Erase, topology checks ("analysis plane", geom/src/lib.rs#L211-L229) straight in EPSG:3857 (a rhumb line on the sphere), extended linearly in latitude beyond 85.05°
$area, Calculate Geometry, Measure tool geodesic on the WGS 84 ellipsoid
geodesic_ring_area_m2, tabulate shares (map_area_m2) straight in lon/lat, or rhumb, on a sphere of R = 6,371,008.8 m
This mixture violates a basic principle: topology (intersection, containment, adjacency) and metrics have to be defined on the same edge model. The model can be planar in a stated CRS (OGC Simple Features, PostGIS geometry) or geodesic (PostGIS geography, S2). Here, the shape that is clipped is not the shape that is measured, and neither is the shape that was imported.

Error figures, computed with PROJ 9.8.1 / GeographicLib. Each is the offset at the midpoint of an east–west edge given in UTM 33N, between the UTM straight line and the edge RustGIS clips with (straight in EPSG:3857):

Edge length Latitude UTM chord vs. analysis plane UTM chord vs. geodesic
1 km 48° 0.022 m ≤ 0.001 m
10 km 48° 2.18 m ≤ 0.06 m
10 km 60° 3.39 m ≤ 0.06 m
50 km 48° 54.4 m ≤ 1.3 m
Clipping cadastral, administrative or zoning data imported from UTM/GK therefore moves boundaries by metres. Your docs already show symptoms of this, for example area_km2 coming out at "about 64%" of the area its percentage is based on (analysis.md#L1105-L1116). Tolerances given in "plane metres" also scale with sec φ: 10 plane metres are only 5 m on the ground at 60°. EPSG's own remark calls EPSG:3857 "not a recognised geodetic system", and the NGA advisory notice (2014) rules it out for positioning purposes.

#2032 C1d keeps the analysis plane even after the flip ("Tools read their inputs in lon/lat through one boundary"), so this is not on the roadmap.

Requests: (1) Specify one explicit edge model per layer or per project, and write it down. (2) Run planar overlays in the layer's or project's CRS, or in a local conformal or equal-area projection fitted to the operands (TM/LAEA/AEQD), never in EPSG:3857. Alternatively, offer a fully geodesic overlay (S2-like). (3) Densify consistently with a stated tolerance when changing between edge models. (4) Give tolerances in ground metres.

A3. Measurements are inconsistent
The Measure tool and $area measure on the ellipsoid. That was #939's stated aim ("the panel agrees with the geoprocessing tools"). Several other paths still use the sphere:

Mensuration (imagery) on Earth: geodesic_length_m / geodesic_ring_area_m2, i.e. the sphere (engine/src/cmd/imagery.rs#L1824, #L1854). The same polygon therefore gets different numbers from Measure and from Mensuration.
Spatial Join "largest overlap" (join.rs#L192), tabulate shares (tools.rs#L5562) and network snapping distances (network.rs) all use the sphere or haversine.
Spherical errors compared with the ellipsoid, checked against GeographicLib and the exact authalic quadrangle area:

0° 48° 60° 70°
Area of a 1°×1° cell +0.45 % −0.30 % −0.57 % −0.74 %
10 km N–S (haversine) +56 m +0.3 m −20 m –
10 km E–W (haversine) −11 m −30 m −36 m –
A tool with the professional-sounding name "Mensuration" that is off by 0.5 % is not acceptable for surveying work.

Requests: one central measurement service on the ellipsoid (GeographicLib). The sphere should only be used for other bodies, and only when that is stated explicitly.

A4. Datum transformations: what is silently lost
Grid transformations declared in the file are not applied. NTv2 or NADCON in a BOUNDCRS, PROJ4_GRIDS or +nadgrids are replaced by the code's Helmert, with only a notice (data.md#L226). For Austrian (AT_GIS_GRID), German (BeTA2007) or Swiss (CHENyx06) data, this downgrades the result from cm level to metre level.
Time-dependent Helmert (EPSG method 1066) without its epoch is read as a static coordinate-frame rotation, with the rates discarded (wkt.rs#L1497). PROJ refuses this for good reason.
No coordinate epoch at all. terrio-crs supports TransformOptions::source_coordinate_epoch, but RustGIS never sets it. Epochs from GeoPackage (epoch column), PROJJSON/GeoParquet and FlatGeobuf are ignored. For dynamic frames (ITRF20xx, WGS 84 (Gxxxx), ATRF2014, NATRF2022) that means drift of 2.5–7 cm per year.
Transformation accuracy is never shown to the user. PROJ provides an accuracy for every operation; RustGIS doesn't surface it. NAD83, RDN2008 and IGM95 are treated as "WGS 84-like".
When a WKT is identified as UTM, NAD83 realisations (HARN, CSRS, 2011) count as WGS 84-like (wkt.rs#L1769). That is a name-based heuristic that ignores differences of about 1–2 m.
Requests: apply file-declared grid transformations whenever the grid can be found or downloaded. Refuse time-dependent operations without an epoch instead of reading them as something else. Carry coordinate epochs through the data model. Show the operation and its accuracy in the layer properties.

A5. Heights are discarded
Z and M are dropped on import (lib.rs#L425). Geometry is 2D only, with no curves and no GeometryCollection. There are no vertical or compound CRSs and no geoid model, so you can't tell ellipsoidal from orthometric heights. Viewshed, slope and Mensuration's "surface distance" take DEM values without knowing their vertical datum. Even a simple round trip such as GPX/Shapefile Z → export loses data. For geodetic work (levelling, GNSS heights, LiDAR, linear referencing via M) that rules RustGIS out. #726 is about 3D scenes. What's asked here is more basic.

Requests: at least store Z and M losslessly and write them back out, separately from #726. Model vertical CRSs (terrio-crs already has geoid routes).

A6. CRS identity and persistence
Crs::Epsg(u16) (crs.rs#L265). Other authorities (ESRI, IGNF, IAU) are saved as PROJ strings, so their identity is lost.
From your docs: "A project saved by an earlier release keeps the definition it saved for a layer in an ESRI code, so that layer is placed as it was then (ESRI:102144 246 m from PROJ 9.9.0)" (data.md#L202-L206). The same code puts the same data in two places 246 m apart, depending on when the project was saved. In practice that is undetectable for users.
Requests: save authority:code together with WKT2/PROJJSON and the registry version (EPSG v13.102 / PROJ 9.9.0). When a newer definition differs, warn the user and show the size of the shift.

A7. The overlay's precision model depends on the extent
OverlayGrid snaps to the operands' extent ÷ 2³⁰ in plane metres (tools.rs#L5668-L5678). For a global extent that is about 3.7 cm. So the same parcel cut by a small mask and by a large one gives different coordinates. The results aren't reproducible, and they don't follow the precision of the data.

Request: an explicit precision model that the user can set, like JTS PrecisionModel or GEOS gridSize, given in ground units.

B. Designing, maintaining and providing the GIS
B1. Amount of change versus reviewability
The repo was created on 2026-10-10. At e4cc3ae it has about 1,736 commits on main, about 718,000 lines of Rust and about 970,000 tracked lines in total. In the last 7 days alone there were 386 commits with +193,000 / −24,000 lines. 400 of the squash commits carry Co-authored-by: Claude … trailers (over 2,600 trailer lines in total). No team can review that much change at a depth that holds up for numerical or geodetic code. The quality claims ("as PROJ 9.9.0 does", "within a millimetre") can't be checked externally at this rate.

B2. Governance: review is effectively one person
automerge.yml#L52 approves PRs with a maintainer token, and "the token owner … bypass[es] the review". claude-autofix.yml pushes to contributors' forks with that token. Together, these let the two-person rule be bypassed.

Requests: a CODEOWNERS file with required human review for crates/geom, crates/data/src/raster/crs*, wkt.rs, reproject.rs and crates/analysis. No bot approvals on these paths.

B3. The test oracle
There are more than 8,200 #[test]s, which is impressive, but they are mostly written in the same pass as the code. PROJ reference values are a good start. What's missing is independent conformance suites in CI:

PROJ's gie suite, run on the paths RustGIS actually uses
GeographicLib GeodTest.dat
the examples in EPSG Guidance Note 7-2
the JTS/GEOS XML test suite for DE-9IM and overlays
OGC CITE / GeoPackage conformance
round-trip tests through GDAL/OGR (ogr2ogr), including Z/M, epochs and BOUNDCRS
B4. The core dependency, terrio-crs
terrio-crs is pinned by git revision (Cargo.toml#L74) and isn't released on crates.io. The repo was created on 2026-10-14, is about 409,000 lines, and is developed by the same organisation in the same way. Every coordinate in RustGIS depends on this one, independently unreviewed, "pure-Rust PROJ port". That is a single point of failure for correctness and for supply-chain trust.

Requests: a crates.io release with semver, a published comparison against PROJ over the whole EPSG catalogue (the numbers, not just a claim), and an independent review.

B5. Monolithic files
engine/src/tests.rs (55,000 lines), analysis/src/tools.rs (16,800), render/src/lib.rs (13,800), ui-egui/src/panes.rs (9,500) and ui-egui/src/lib.rs (9,500) are too large to understand locally, review or own.

B6. Release cadence and format stability
Eight releases (v0.1.0 to v0.7.0) between 2026-10-12 and 2026-11-16. The project format changes through "capabilities". There is no LTS, no written semver policy for the project format, and no deprecation policy. For institutions that would provide RustGIS (universities, agencies, survey offices), that is an operating risk.

Requests: a semver and LTS policy, a versioned specification of the project format (not just a generated JSON schema), and a deprecation process.

B7. Documentation
The user guide is very extensive, but much of it describes the implementation rather than promising behaviour. Some paragraphs and table cells run over 2,000 characters (for example the GeoJSON row in data-formats.md). A conceptual page on the geodetic model is missing: which CRS data is stored in, which edge model is used, which transformation is used, error budgets and guarantees.

B8. Scope
Desktop, web, Android, iOS, Python, CLI, MCP, AI assistant, 22 languages, plugins (process plugins aren't sandboxed, per architecture.md) and over 1,000 tools, all in about six weeks. That maintenance surface doesn't match the reviewer base (A/B above). A feature freeze is needed until the geodetic core (A1–A6) is stable.

Priorities (suggested)
A2 (one edge model, no overlays in EPSG:3857) and A3 (one ellipsoidal measurement service).
A1/A6 (native storage, saving the operation/registry version and warning when it changes; finish #2032 C2c).
A4 (apply file-declared grids, coordinate epochs, show accuracy) and A5 (keep Z/M without loss).
B2/B3 (required human review for geodetic code, external conformance suites in CI).
B4/B6 (terrio-crs on crates.io, stability and LTS policy).
Reproducing the numbers

pip install pyproj geographiclib (PROJ 9.8.1)

from pyproj import Transformer, Geod
g = Geod(ellps="WGS84")
u2ll = Transformer.from_crs(32633, 4326, always_xy=True)
ll2m = Transformer.from_crs(4326, 3857, always_xy=True)
m2ll = Transformer.from_crs(3857, 4326, always_xy=True)
for L, N in [(1000, 5320000), (10000, 5320000), (10000, 6650000), (50000, 5320000)]:
E0 = 500000 - L / 2
A, B, Mu = (u2ll.transform(E0 + d, N) for d in (0, L, L / 2))
Am, Bm = ll2m.transform(*A), ll2m.transform(*B)
Mm = m2ll.transform((Am[0] + Bm[0]) / 2, (Am[1] + Bm[1]) / 2)
print(L, N, round(g.inv(*Mu, *Mm)[2], 3), "m UTM chord vs. EPSG:3857 chord")
import math
from geographiclib.geodesic import Geodesic
R = 6371008.8; G = Geodesic.WGS84
def hav(lat1, lon1, lat2, lon2):
p1, p2 = map(math.radians, (lat1, lat2)); dl = math.radians(lon2 - lon1)
h = math.sin((p2 - p1) / 2)**2 + math.cos(p1) * math.cos(p2) * math.sin(dl / 2)**2
return 2 * R * math.asin(math.sqrt(h))
for lat in (0, 48, 60):
for az in (0, 90):
d = G.Direct(lat, 10, az, 10000)
print(lat, az, round(hav(lat, 10, d['lat2'], d['lon2']) - 10000, 1), "m on 10 km")
I'm happy to help with A2/A3 (edge model and measurement service) or with setting up conformance suites (B3).

Created with help from Perplexity

Estimated scope

Wishlist: a larger or longer-term idea

Alternatives considered

None so far - some may show themselves

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.