Skip to content

Commit

Permalink
Robust fix for the missing sign problem...
Browse files Browse the repository at this point in the history
The previous update did not correctly addressed the bug found and would screw up lots of other things.

W ehave now reverted and added the correct fix for the missing sign problem we found recently... Cheers!
  • Loading branch information
mountaineerbr committed Nov 18, 2024
1 parent 153ac56 commit daa535c
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions geoconv.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# v0.4.1 nov/2024 by mountaineerbr GPLv3+
# v0.5 nov/2024 by mountaineerbr GPLv3+
# Convert geocoordinates to various formats

SCALE=${SCALE:-6}
Expand Down Expand Up @@ -105,19 +105,27 @@ ddm_degf()

geoconvf()
{
local arg sign Ah Ahh Ax Ay Az Bh Bhh Bx By Bz dd ddm ddfmt ddmfmt
local arg sign Ah Ahh Ax Ay Az Bh Bhh Bx By Bz dd ddm ddfmt ddmfmt loop

set -- ${@//[!0-9a-zA-Z.+-]/ }
for arg
do unset sign #coordenate sign eater
do ((++loop))
unset sign #coordenate sign eater
case "$arg" in
+|[Nn]|[Nn]orth|[EeLl]|[Ee]ast|[NnEeLl+][0-9.]*|*[0-9.][NnEeLl])
sign=+;;
-|[Ss]|[Ss]outh|[WwOo]|[Ww]est|[SsWwOo-][0-9.]*|*[0-9.][SsWwOo])
sign=-;;
+|[Nn]|[Nn]orth|[EeLl]|[Ee]ast|[NnEeLl+][0-9.]*|*[0-9.][NnEeLl]|?*)
sign=+;;
esac
if [[ -n $sign ]]
then if [[ -z $Ah$Bx ]]
then if [[ -z $Ah$Bx ]] &&
#the missing sign problem
if [[ $arg = *[A-Za-z]* ]]
then :
elif ((loop==1))
then :
else false
fi
then Ah=$sign
elif [[ -z $Bh ]]
then Bh=$sign
Expand Down

0 comments on commit daa535c

Please sign in to comment.