1

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).

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
justik
  • 113
  • 4
  • 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... https://stackoverflow.com/questions/14509652/what-is-the-difference-between-and-in-a-cmd-file 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
  • @Spacedman please turn your comment into an answer, since it might be helpful to many people. – AndreJ Sep 25 '18 at 09:37

1 Answers1

1

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.

Spacedman
  • 63,755
  • 5
  • 81
  • 115