aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Karney <charles@karney.com>2018-07-11 11:10:28 -0400
committerCharles Karney <charles@karney.com>2018-07-11 11:10:28 -0400
commit3efab3e9ee22de67651ee24c89ac750c212cc9a0 (patch)
tree4d4759c7b147781a8cdc2180b9c3492b51600716
parenta7f05deb5504d202dbb37654fad54cb42957251a (diff)
downloadPROJ-3efab3e9ee22de67651ee24c89ac750c212cc9a0.tar.gz
PROJ-3efab3e9ee22de67651ee24c89ac750c212cc9a0.zip
Revert pj_units to_meters entries for US units.
Bletch, pj_init also decodes the to_meters field of pj_unit, but only handles plain numbers or 1/nnn, but not 1./nnn or mmm/nnn. (So the original code would have not decoded the us-in entry properly.) Probably pj_init should be changed to use the factor field instead. Alternatively pj_init should look for a "/" anywhere in the field and decode the numerator and denominator as separate doubles. This would be needed if ratios are ever to be entered directly by the user (this is the strategy used by GeographicLib). And then, of course, the functionality should be provided by a separate utility function.
-rw-r--r--src/geod_set.c2
-rw-r--r--src/pj_units.c8
2 files changed, 5 insertions, 5 deletions
diff --git a/src/geod_set.c b/src/geod_set.c
index 1116e7ee..bd388d34 100644
--- a/src/geod_set.c
+++ b/src/geod_set.c
@@ -40,7 +40,7 @@ geod_set(int argc, char **argv) {
to_meter = unit_list[i].factor;
fr_meter = 1 / to_meter;
} else
- to_meter = fr_meter = 1.;
+ to_meter = fr_meter = 1;
geod_f = es/(1 + sqrt(1 - es));
geod_ini();
/* check if line or arc mode */
diff --git a/src/pj_units.c b/src/pj_units.c
index e8421dea..44abaf34 100644
--- a/src/pj_units.c
+++ b/src/pj_units.c
@@ -26,10 +26,10 @@ pj_units[] = {
{"ch", "20.1168", "International Chain", 20.1168},
{"link", "0.201168", "International Link", 0.201168},
{"us-in", "1/39.37", "U.S. Surveyor's Inch", 100/3937.0},
- {"us-ft", "12/39.37", "U.S. Surveyor's Foot", 1200/3937.0},
- {"us-yd", "36/39.37", "U.S. Surveyor's Yard", 3600/3937.0},
- {"us-ch", "792/39.37", "U.S. Surveyor's Chain", 79200/3937.0},
- {"us-mi", "63360/39.37", "U.S. Surveyor's Statute Mile", 6336000/3937.0},
+ {"us-ft", "0.304800609601219", "U.S. Surveyor's Foot", 1200/3937.0},
+ {"us-yd", "0.914401828803658", "U.S. Surveyor's Yard", 3600/3937.0},
+ {"us-ch", "20.11684023368047", "U.S. Surveyor's Chain", 79200/3937.0},
+ {"us-mi", "1609.347218694437", "U.S. Surveyor's Statute Mile", 6336000/3937.0},
{"ind-yd", "0.91439523", "Indian Yard", 0.91439523},
{"ind-ft", "0.30479841", "Indian Foot", 0.30479841},
{"ind-ch", "20.11669506", "Indian Chain", 20.11669506},