Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format PROJ strings nicely #1543

Closed
kbevers opened this issue Jul 2, 2019 · 3 comments
Closed

Format PROJ strings nicely #1543

kbevers opened this issue Jul 2, 2019 · 3 comments
Labels
enhancement pinned Prevent stale-bot from closing an issue

Comments

@kbevers
Copy link
Member

kbevers commented Jul 2, 2019

Instead of this

> projinfo -s GDA94 -t GDA2020 -o PROJ
Candidate operations found: 1
Note: using '--spatial-test intersects' would bring more results (5)
-------------------------------------
Operation n┬░1:

EPSG:8048, GDA94 to GDA2020 (1), 0.01 m, Australia - GDA

PROJ string:
+proj=pipeline +step +proj=axisswap +order=2,1 +step +proj=unitconvert +xy_in=deg +xy_out=rad +step +proj=push +v_3 +step +proj=cart +ellps=GRS80 +step +proj=helmert +x=0.06155 +y=-0.01087 +z=-0.04019 +rx=-0.0394924 +ry=-0.0327221 +rz=-0.0328979 +s=-0.009994 +convention=coordinate_frame +step +inv +proj=cart +ellps=GRS80 +step +proj=pop +v_3 +step +proj=unitconvert +xy_in=rad +xy_out=deg +step +proj=axisswap +order=2,1

projinfo and the relevant API functions should return this

> projinfo -s GDA94 -t GDA2020 -o PROJ
Candidate operations found: 1
Note: using '--spatial-test intersects' would bring more results (5)
-------------------------------------
Operation n┬░1:

EPSG:8048, GDA94 to GDA2020 (1), 0.01 m, Australia - GDA

PROJ string:
+proj=pipeline 
  +step +proj=axisswap +order=2,1 
  +step +proj=unitconvert +xy_in=deg +xy_out=rad 
  +step +proj=push +v_3 +step +proj=cart +ellps=GRS80 
  +step +proj=helmert +x=0.06155 +y=-0.01087 +z=-0.04019 +rx=-0.0394924 
        +ry=-0.0327221 +rz=-0.0328979 +s=-0.009994 +convention=coordinate_frame
  +step +inv +proj=cart +ellps=GRS80 
  +step +proj=pop +v_3 
  +step +proj=unitconvert +xy_in=rad +xy_out=deg
  +step +proj=axisswap +order=2,1

or something to that effect. This makes it a lot easier to read long pipelines. It will also be beneficial to downstream projects that display the PROJ string of a transformation (e.g. QGIS).

@rouault
Copy link
Member

rouault commented Jul 2, 2019

@kbevers Wanna try implementing this ? Should be around line

for (const auto &step : d->steps_) {

I'd suggest to not to this by default because it will break a lot of existing PROJ tests (and likely a few GDAL ones as well). So should probably controlled by a PRETTY_FORMATTING=YES option that projinfo would set. proj_as_proj_string() should be enhanced to recognize that option to.

@kbevers
Copy link
Member Author

kbevers commented Jul 2, 2019

Wanna try implementing this ?

That was my intention, yes. I don't think I'll find the time for it this week but Nyalls QGIS screenshots reminded me that this should be done. Thanks for the pointers.

So should probably controlled by a PRETTY_FORMATTING=YES option that projinfo would set. proj_as_proj_string() should be enhanced to recognize that option to.

How about a proj_string_pretty_print() function that takes a PROJ string and return it nicely formatted?

@stale
Copy link

stale bot commented Jan 8, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jan 8, 2020
@kbevers kbevers added the pinned Prevent stale-bot from closing an issue label Jan 8, 2020
@stale stale bot removed the wontfix label Jan 8, 2020
rouault added a commit to rouault/PROJ that referenced this issue Oct 15, 2020
…n projinfo (unless --single-line is specified) (fixes OSGeo#1543)
rouault added a commit that referenced this issue Oct 18, 2020
Add multi-line PROJ string export capability, and use it by default in projinfo (unless --single-line is specified) (fixes #1543)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement pinned Prevent stale-bot from closing an issue
Projects
None yet
Development

No branches or pull requests

2 participants