Skip to content

script doesnt account for negative longitude

hello, under the case statements for latitude/ longitude:
(Longitude:*) long="$line";

long="$(echo $long | sed -r 's/.* ([0-9]+\.*[0-9]*).*?/\1/')"

it wont account for a negative value like -91.123456

so you end up with values like this that arent fed into appium(inserting the key "Longitude:") :

44.654321
Longitude: -91.123456°
222.100000
44.654321
Longitude: -91.123456°
222.100000
44.654321
Longitude: -91.123456°
222.100000

substituted for following term

long="$(echo $long | sed 's/°//' |awk '{print $2}')"

generates this output.

44.654321
-91.123456
222.100000
44.654321
-91.123456
222.100000
44.654321
-91.123456
222.100000

i did not need to correct lat , as i have a positive value there.

i still have some work to do here but that was a blocker trying to use your approach, perhaps youre testing in a region where lat and long are positive values. thank you.

note: one of my gps devices (cellular, quectel) inserts a ° character after the value and one of them (USB) does not. (your original case statement does get rid of it from $lat , if present)

Edited by epsilonaurigae