diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2019-03-24 13:21:58 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-24 13:21:58 +0100 |
| commit | 4f787973563fba4a4508340e6544f5c3c349570d (patch) | |
| tree | a4bd9e30b2bdb6365d4819428636517d43e4b332 /src/apps/cs2cs.cpp | |
| parent | e658bbc00a11ac1599198b148144145ba2917f56 (diff) | |
| parent | 10e1b7b75f70c704cf78a7eb7197beebb4b82d4a (diff) | |
| download | PROJ-4f787973563fba4a4508340e6544f5c3c349570d.tar.gz PROJ-4f787973563fba4a4508340e6544f5c3c349570d.zip | |
Merge pull request #1355 from kbevers/cs2cs-4d
Make cs2cs support 4D coordinates.
Diffstat (limited to 'src/apps/cs2cs.cpp')
| -rw-r--r-- | src/apps/cs2cs.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/apps/cs2cs.cpp b/src/apps/cs2cs.cpp index dafd06f8..c68572fa 100644 --- a/src/apps/cs2cs.cpp +++ b/src/apps/cs2cs.cpp @@ -113,6 +113,17 @@ static void process(FILE *fid) z = strtod(s, &s); + /* To avoid breaking existing tests, we read what is a possible t */ + /* component of the input and rewind the s-pointer so that the final */ + /* output has consistant behaviour, with or without t values. */ + /* This is a bit of a hack, in most cases 4D coordinates will be */ + /* written to STDOUT (except when using -E) but the output format */ + /* speficied with -f is not respected for the t component, rather it */ + /* is forward verbatim from the input. */ + char *before_time = s; + double t = strtod(s, &s); + s = before_time; + if (data.v == HUGE_VAL) data.u = HUGE_VAL; @@ -120,11 +131,11 @@ static void process(FILE *fid) --s; /* assumed we gobbled \n */ if (echoin) { - char t; - t = *s; + char temp; + temp = *s; *s = '\0'; (void)fputs(line, stdout); - *s = t; + *s = temp; putchar('\t'); } @@ -141,7 +152,7 @@ static void process(FILE *fid) coord.xyzt.x = data.u; coord.xyzt.y = data.v; coord.xyzt.z = z; - coord.xyzt.t = HUGE_VAL; + coord.xyzt.t = t; coord = proj_trans(transformation, PJ_FWD, coord); data.u = coord.xyz.x; data.v = coord.xyz.y; |
