Convert Degree Decimal to Degree Minutes and Seconds


I have issues when converting from Degrees (taking them from Map and location sensor) to Degrees , minutes and seconds.

I have found this thread: Convert Degree Decimal to Degree Minute Second

It is not working and its gives the following error:

The operation floor cannot accept the arguments: , [""]

Seems like the GPS is taking degrees with some sort of a symbol, but I am not sure if this is my issue.

My code:

So it looks like there are two issues:

  1. You set global decimalDegrees to the text value of a field. It's possible that field is empty, and so the rest of the logic won't work. Make sure it contains a valid decimal value first.

  2. You set global degrees to the result of is number?, which returns a true/false value. Later math operations won't be able to do much with this. You'll want to remove the is number? check here.

Your code is not the example code Camino. When you copy code, copy it exactly. You did not. The example code works, your code does not.

It is not a great idea to use a Label as a variable as Evan pointed out.

Follow Evan's advice, he is probably correct in what he observed. You can make a simple experiment: replace decimalDegrees to etqLatitude2.text with decimalDegrees to 30.12345 (use a blue Math Block for the number). What happens when you press Button1?