Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 9.3] cs2cs: fix handling of input coordinates in grad (fixes #3800) #3886

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
cs2cs: fix handling of input coordinates in grad (fixes #3800)
rouault authored and github-actions[bot] committed Sep 6, 2023
commit 274e16027b0fd7e4cb53f561bb5e47a75fcbf3aa
8 changes: 4 additions & 4 deletions src/apps/cs2cs.cpp
Original file line number Diff line number Diff line change
@@ -171,7 +171,7 @@ static void process(FILE *fid)

if (data.u != HUGE_VAL) {

if (srcIsLongLat) {
if (srcIsLongLat && fabs(srcToRadians - M_PI / 180) < 1e-10) {
/* dmstor gives values to radians. Convert now to the SRS unit
*/
data.u /= srcToRadians;
@@ -922,10 +922,10 @@ int main(int argc, char **argv) {
}

/* set input formatting control */
if (!srcIsLongLat)
informat = strtod;
else {
if (srcIsLongLat && fabs(srcToRadians - M_PI / 180) < 1e-10)
informat = dmstor;
else {
informat = strtod;
}

if (!destIsLongLat && !oform)
6 changes: 6 additions & 0 deletions test/cli/testvarious
Original file line number Diff line number Diff line change
@@ -120,6 +120,12 @@ $EXE +proj=utm +zone=11 +datum=WGS84 +pm=3 \
500000 3000000
EOF
echo "##############################################################" >> ${OUT}
echo Test input in grad >> ${OUT}
#
$EXE EPSG:4807 EPSG:27572 -E >>${OUT} <<EOF
64.44444444 2.9586342556
EOF
echo "##############################################################" >> ${OUT}
echo Test geocentric x/y/z generation. >> ${OUT}
#
$EXE +proj=latlong +datum=WGS84 \
3 changes: 3 additions & 0 deletions test/cli/tv_out.dist
Original file line number Diff line number Diff line change
@@ -31,6 +31,9 @@ Test support for the lon_wrap switch.
Test simple prime meridian handling within a projection.
500000 3000000 113dW 27d7'20.891"N 0.000
##############################################################
Test input in grad
64.44444444 2.9586342556 760724.02 3457334.86 0.00
##############################################################
Test geocentric x/y/z generation.
0d00'00.001"W 0d00'00.001"N 0.0 6378137.00 -0.03 0.03
0d00'00.001"W 0d00'00.001"N 10.0 6378147.00 -0.03 0.03