I will use cs2cs to convert between Sweref99 and WGS84. It works fine, but I want the result table in a file and not just in a DOS window on the screen. How ??

Hans Johansson

  • Where do you have your source coordinates? In a text file, Excel, database...?
    – user30184
    Mar 19 '18 at 14:56
  • The source coordinates is in text file, the conversion works all right, but I want to have the result coordinates in a file too. Not on the DOS screen. Mar 19 '18 at 16:49

cs2cs takes one or more filenames as arguments, see the documentation for more detail.

One or more files (processed in left to right order) specify the source of data to be transformed. A - will specify the location of processing standard input. If no files are specified, the input is assumed to be from stdin. For input data the two data values must be in the first two white space separated fields and when both input and output are ASCII all trailing portions of the input line are appended to the output line.

  • Do you understand what that all means? I must admit that I don't.
    – user30184
    Mar 19 '18 at 15:27
  • yes, or I would not have posted it, you need a file with at least 2 data values per line - the first 2 are lat/lon or x.y and the rest will be copied over.
    – Ian Turton
    Mar 19 '18 at 15:38
  • Could you write a complete working example with one input and one output file?
    – user30184
    Mar 20 '18 at 6:08
  • I did not find any other way than to redirect the output with ">". cs2cs +init=epsg:4326 +to +init=epsg:3857 cs2cs_input.txt > cs2cs_output.txt.
    – user30184
    Mar 20 '18 at 11:38

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.