How do I change the accuracy of the output coordinates X,Y in the Proj.4 library (version 4.9)?

In accordance with the manual I tried:

proj +proj=poly -f '%.4f' +R=1

However, for lat=lon=50, the results

'.4f'   '.4f'

indicate that the format has not been recognized (OS: Win10).

  • Works for me: echo "50 50" |proj +proj=poly -f '%.4f' +R=1 prints out "0.5201 1.0533" (linux command line) – Spacedman Sep 24 '18 at 20:03
  • @ Spacedman: Are you working under GNU/Linux? – justik Sep 24 '18 at 20:07
  • Yes, does Windows command line treat % as a special character? So proj never sees it? – Spacedman Sep 24 '18 at 20:08
  • 4
    Try two %% signs instead of one... stackoverflow.com/questions/14509652/… seems to think you need one on the command line and two in a batch file. – Spacedman Sep 24 '18 at 20:10
  • @ Spacedman: Thank you very much for your advice and explanation, it works well! – justik Sep 24 '18 at 20:11

Windows' command line uses the % sign as a special character for various things. In batch scripts, you need two % signs to signify what you want is actually a % sign. So a .BAT file running proj commands would look like this:

proj +proj=poly -f '%%.4f' +R=1

For more, see https://stackoverflow.com/questions/14509652/what-is-the-difference-between-and-in-a-cmd-file or a Windows command reference. Note you can use the Windows Linux subsystem or Cygwin to get a "bash" shell instead of the Windows command line interpreter.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.