Skip to content

getTOWGS84Parameters(): return the inverted values for an inverse Helmert transformation - #4914

Open
birkskyum wants to merge 1 commit into
OSGeo:masterfrom
birkskyum:towgs84-inverse-helmert
Open

birkskyum wants to merge 1 commit into
OSGeo:masterfrom
birkskyum:towgs84-inverse-helmert

Conversation

@birkskyum

Copy link
Copy Markdown

When EPSG only defines a 7-parameter Helmert transformation from WGS 84 to a datum, the bound CRS export writes its forward parameters as +towgs84, so the shift goes the wrong way. projinfo EPSG:6991 --boundcrs-to-wgs84 -o PROJ gives a string that PROJ itself places ~156 m from its own EPSG:4326 to EPSG:6991 result. proj_coordoperation_get_towgs84_values() returns the same forward values for every such reversed transformation, 17 of them among the operations to WGS 84.

A 7-parameter inverse stays an InverseTransformation, which keeps the parameter values of the forward one. This PR makes getTOWGS84Parameters() use the approximate inverse there, as _exportToWKT() already does.

  • AI (Copilot or something similar) supported my development of this PR. See our policy about AI tool use. Use of AI tools must be indicated. (Claude Opus 5.5)
  • Tests added
  • Added clear title that can be used to generate release notes

@kbevers

kbevers commented Oct 19, 2026

Copy link
Copy Markdown
Member

projinfo EPSG:6991 --boundcrs-to-wgs84 -o PROJ gives a string that PROJ itself places ~156 m from its own EPSG:4326 to EPSG:6991 result

Can you show this using PROJ command line tools? It would be easier for me to understand if expressed with an example using the standard tools

@birkskyum

Copy link
Copy Markdown
Author

@kbevers Sure. With PROJ master, at a point in Jerusalem:

$ projinfo -s EPSG:4326 -t EPSG:6991 --summary
Candidate operations found: 1
unknown id, WGS 84 to IG05/12 Intermediate CRS + Israeli TM, 0.1 m, Israel - onshore; Palestine onshore.

$ projinfo EPSG:6991 -o PROJ -q
+proj=tmerc +lat_0=31.7343936111111 +lon_0=35.2045169444444 +k=1.0000067 +x_0=219529.584 +y_0=626907.39 +ellps=GRS80 +towgs84=-23.772,-17.49,-17.859,0.3132,1.85274,-1.67299,5.4262 +units=m +no_defs +type=crs

$ echo 31.7784 35.2066 | cs2cs -d 3 EPSG:4326 EPSG:6991
219660.851	631746.029 0.000

$ echo 31.7784 35.2066 | cs2cs -d 3 EPSG:4326 +to +proj=tmerc +lat_0=31.7343936111111 +lon_0=35.2045169444444 +k=1.0000067 +x_0=219529.584 +y_0=626907.39 +ellps=GRS80 +towgs84=-23.772,-17.49,-17.859,0.3132,1.85274,-1.67299,5.4262 +units=m +no_defs
219792.932	631827.902 0.000

The exported string lands 155 m from PROJ's own result. EPSG:9189 is defined from WGS 84 to IG05/12, so +towgs84 needs its inverse, but the export writes the forward parameters. --boundcrs-to-wgs84 gives the same string.

With this PR, projinfo EPSG:6991 -o PROJ gives +towgs84=23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262, and the same cs2cs call returns 219660.851 631746.029, identical to EPSG:4326 to EPSG:6991.

This branch has not been deployed

No deployments
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