Repository navigation
Add SPZ_NIANTIC_georeference extension - #103
Closed
diegomazala wants to merge 1 commit into
Closed
diegomazala wants to merge 1 commit into
diegomazala wants to merge 1 commit into
Conversation
diegomazala
requested review from
ProjitB,
azadbal and
daniel-niantic-spatial
as code owners
August 4, 2026 16:33
diegomazala
force-pushed
the
feat/niantic-georeference-extension
branch
2 times, most recently
from
August 4, 2026 18:47
4325d7c to
870886f
Compare
Defines SpzExtensionGeoreferenceNiantic (type 0x4E530001) carrying a
similarity transform from the local frame to a geocentric CRS (origin,
unit quaternion, uniform scale, EPSG code) with optional epoch and WKT2
provenance:
p_crs = scale * (q * p_local * q^-1) + origin
scale is uniform (isotropic) only, matching the classic 7-parameter
Helmert/similarity transform used for local-to-global CRS registration:
it corrects for the scale ambiguity inherent to unreferenced
reconstruction (e.g. monocular SfM), which is always isotropic under a
calibrated-camera model. There is deliberately no anisotropic scale or
shear field.
The extension is a descriptor only: origin/rotation/scale are
full-precision doubles, independent of the 24-bit fixed-point
quantization used for Gaussian positions, and the library never applies
the transform to the Gaussian data itself. Post-transform heights are
ellipsoidal by construction; wkt records the source compound CRS
(including vertical datum) as provenance only, never as a target
definition.
Wires the extension into the record parser, rejects reserved crs_epsg 0,
unsupported ext_version, and non-finite/non-positive scale on load,
normalizes non-unit quaternions within tolerance, and caps wkt size on
write to guard the u32 record length against overflow (oversized wkt is
omitted, never truncated).
Exposes the extension in Python (nanobind) and WASM (embind + TypeScript
declarations), mirroring the existing Adobe extension bindings. Adds
round-trip and malformed-payload tests, allocates vendor ID 0x4E53 ("NS"),
and documents the payload layout and validation rules in
extensions/README.md and the top-level README.
diegomazala
force-pushed
the
feat/niantic-georeference-extension
branch
from
August 4, 2026 19:14
870886f to
58b7df9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
SPZ_NIANTIC_georeference(type0x4E530001), an extension that records a similarity transform placing an SPZ asset's local frame into an Earth-centered geocentric CRS (e.g. EPSG:4978, WGS84 ECEF):origin(double[3], meters),rotation(double[4], unit quaternion), andscale(double, dimensionless uniform factor) carry the transform at full precision — independent of the 24-bit fixed-point quantization used for Gaussian positions themselves.scaleis uniform (isotropic) only, matching the classic 7-parameter Helmert/similarity transform used for local-to-global CRS registration. It corrects for the scale ambiguity inherent to unreferenced reconstruction (e.g. monocular SfM), which is always isotropic under a calibrated-camera model — there is deliberately no anisotropic scale or shear field, since that would describe a different problem (a deformed local frame) than this extension addresses.crs_epsgnames the target geocentric CRS;epoch(decimal year) and an optional WKT2wktstring are provenance fields.wktrecords the source compound CRS (including vertical datum) as provenance — it is never authoritative for transforming data, since orthometric-vs-ellipsoidal height mixups silently shift world position by tens of meters.Design notes / prior art
The split between a numeric transform (authoritative) and CRS metadata (descriptive) mirrors patterns in two existing geospatial formats:
transform— a 4×4 matrix mapping a tile's local frame into the tileset's global frame, commonly EPSG:4978 (ECEF). That matrix already supports scale as a first-class citizen (as does glTF's TRS node convention); this extension'sscalefield brings the same capability without requiring a full affine matrix.wktis metadata about where it came from (compound CRS incl. vertical datum), since a reader must not re-derive a transform from it.Testing
extensions/cc/georeference-niantic.{h,cc}— payload struct, serialization, and load-time validation (ext_version, reservedcrs_epsg=0, quaternion normalization, non-finite/non-positivescale, wkt_length bounds, oversized-wkt-on-write guard).tests/python/test_extensions.py— round-trips (with/without epoch and wkt), coexistence withSPZ_ADOBE_safe_orbit_camera, malformed-payload skip paths (including invalidscale: zero, negative, NaN, Inf), and Earth-radius origin precision.extensions/README.mddocuments the payload layout and validation rules; top-levelREADME.mdgets a georeferencing section; vendor ID0x4E53("NS") is allocated in the vendor table.Ran
python -m pytest tests/python/withSPZ_BUILD_EXTENSIONS=ON— 120 passed, 0 skipped, 0 failed.