aboutsummaryrefslogtreecommitdiff
path: root/src/conversions
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2020-04-11 12:13:46 +0200
committerKristian Evers <kristianevers@gmail.com>2020-04-12 12:20:44 +0200
commit925ae56c40b0cfa7d861f55e4332cb5603168a2c (patch)
treea116f540e214a6f4568b8fa0c4877d6d71649b89 /src/conversions
parent21ebdfb89bc4b222c4fb78815971b19192a2a09e (diff)
downloadPROJ-925ae56c40b0cfa7d861f55e4332cb5603168a2c.tar.gz
PROJ-925ae56c40b0cfa7d861f55e4332cb5603168a2c.zip
Add proj_degree_input() and proj_degree_output()
Equivalent to proj_angular_input() and proj_angular_output() but checking for degree units instead. proj_create_crs_to_crs() rarely, if ever, returns pipelines that has radians as input or output so using proj_angular_*() is not a useful check for io units of pipelines. These two new functions should make life a bit easier for users that generally store there angular coordinates in radians. Closes #2027
Diffstat (limited to 'src/conversions')
-rw-r--r--src/conversions/unitconvert.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/conversions/unitconvert.cpp b/src/conversions/unitconvert.cpp
index 609b30e0..172e2c48 100644
--- a/src/conversions/unitconvert.cpp
+++ b/src/conversions/unitconvert.cpp
@@ -476,8 +476,12 @@ PJ *CONVERSION(unitconvert,0) {
return pj_default_destructor(P, PJD_ERR_UNKNOWN_UNIT_ID);
}
Q->xy_factor = f;
- if (normalized_name != nullptr && strcmp(normalized_name, "Radian") == 0)
- P->left = PJ_IO_UNITS_RADIANS;
+ if (normalized_name != nullptr) {
+ if (strcmp(normalized_name, "Radian") == 0)
+ P->left = PJ_IO_UNITS_RADIANS;
+ if (strcmp(normalized_name, "Degree") == 0)
+ P->left = PJ_IO_UNITS_DEGREES;
+ }
}
if ((name = pj_param (P->ctx, P->params, "sxy_out").s) != nullptr) {
@@ -491,8 +495,12 @@ PJ *CONVERSION(unitconvert,0) {
return pj_default_destructor(P, PJD_ERR_UNKNOWN_UNIT_ID);
}
Q->xy_factor /= f;
- if (normalized_name != nullptr && strcmp(normalized_name, "Radian") == 0)
- P->right= PJ_IO_UNITS_RADIANS;
+ if (normalized_name != nullptr) {
+ if (strcmp(normalized_name, "Radian") == 0)
+ P->right= PJ_IO_UNITS_RADIANS;
+ if (strcmp(normalized_name, "Degree") == 0)
+ P->right= PJ_IO_UNITS_DEGREES;
+ }
}
if( xy_in_is_linear >= 0 && xy_out_is_linear >= 0 &&