Skip to content

fix: classify WKT2-2015 GEODCRS with CS[Cartesian] as geocentric#51

Merged
ahocevar merged 2 commits into
proj4js:mainfrom
aloktomarr:fix/geodcrs-cartesian-geocent
Jul 23, 2026
Merged

fix: classify WKT2-2015 GEODCRS with CS[Cartesian] as geocentric#51
ahocevar merged 2 commits into
proj4js:mainfrom
aloktomarr:fix/geodcrs-cartesian-geocent

Conversation

@aloktomarr

Copy link
Copy Markdown
Contributor

Fixes the classification reported in proj4js/proj4js#588.

A WKT2 GEODCRS with a Cartesian coordinate system (geocentric X/Y/Z) in the
USAGE-less WKT2-2015 form was parsed as a geographic (longlat) CRS, so
transforming into it was a no-op instead of a geographic→geocentric conversion.

Cause: the base builder hardcodes coordinate_system.type = 'ellipsoidal'
for GEODCRS and never records the CS subtype. PROJJSONBuilder2019 overrides it
from the CS node (so the USAGE form already worked), but PROJJSONBuilder2015
did not — and its delete … subtype === 'Cartesian' guard never fired (the base
sets .type, not .subtype).

Fix: PROJJSONBuilder2015 now reads the CS node and records its subtype,
mirroring the 2019 builder, so transformPROJJSON classifies a Cartesian
GeodeticCRS as geocent. Added a regression fixture for the USAGE-less WKT2-2015
form. Full suite passes (33/33); no other CRS types are affected.

aloktomarr and others added 2 commits July 23, 2026 00:28
A WKT2 GEODCRS with a Cartesian coordinate system (geocentric X/Y/Z) in the USAGE-less WKT2-2015 form was parsed as a geographic (longlat) CRS, so transforming into it was a no-op instead of a geographic-to-geocentric conversion. The 2015 builder now reads the CS node and records its subtype (mirroring PROJJSONBuilder2019), so transformPROJJSON classifies it as geocent. Adds a regression fixture. Refs proj4js/proj4js#588.
@ahocevar

Copy link
Copy Markdown
Member

Thanks, @aloktomarr. I went ahead and fixed the underlying issue that caused the problem surfaced in proj4js/proj4js#588. The result is a lot of removed code, and the 2015/2019 split in wkt-parser is gone because it is not relevant for the subset of PROJJSON that Proj4js can handle.

@ahocevar
ahocevar merged commit 78eca7a into proj4js:main Jul 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants