aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/proj.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/proj.c b/src/proj.c
index 70ca4033..aa0f07c0 100644
--- a/src/proj.c
+++ b/src/proj.c
@@ -143,10 +143,17 @@ static void process(FILE *fid) {
putchar('\t');
(void)fputs(rtodms(pline, data.v, 'N', 'S'), stdout);
}
- } else { /* x-y or decimal degree ascii output */
+ } else { /* x-y or decimal degree ascii output, scale if warranted by output units */
if (inverse) {
- data.v *= RAD_TO_DEG;
- data.u *= RAD_TO_DEG;
+ if (Proj->left == PJ_IO_UNITS_RADIANS || Proj->left == PJ_IO_UNITS_CLASSIC) {
+ data.v *= RAD_TO_DEG;
+ data.u *= RAD_TO_DEG;
+ }
+ } else {
+ if (Proj->right == PJ_IO_UNITS_RADIANS) {
+ data.v *= RAD_TO_DEG;
+ data.u *= RAD_TO_DEG;
+ }
}
if (reverseout) {
@@ -177,6 +184,7 @@ static void vprocess(FILE *fid) {
projUV dat_ll, dat_xy, temp;
int linvers;
+
if (!oform)
oform = "%.3f";
@@ -247,6 +255,12 @@ static void vprocess(FILE *fid) {
if (postscale) { dat_xy.u *= fscale; dat_xy.v *= fscale; }
}
+ /* apply rad->deg scaling in case the output from a pipeline has degrees as units */
+ if (!inverse && Proj->right == PJ_IO_UNITS_RADIANS) {
+ dat_xy.u *= RAD_TO_DEG;
+ dat_xy.v *= RAD_TO_DEG;
+ }
+
/* For some reason pj_errno does not work as expected in some */
/* versions of Visual Studio, so using pj_get_errno_ref instead */
if (*pj_get_errno_ref()) {