In my app an user inputs some coordinates and then I would like to get Location object.
I tried to use Position.parse() function, but it produces wrong result on my device Quatix 5.
However it works well on Simulator.
My code is
... exportWaypointToSavedLocations(name, "38.856147, -94.800953"); ... function exportWaypointToSavedLocations(name, coordinates) { System.println("Coordinates to convert: " + coordinates); var location = Position.parse(coordinates, Position.GEO_DEG); var coords = location.toDegrees(); System.println("Converted coordinates: " + coords); //PersistedContent.saveWaypoint(location, {:name => name}); }
The result was the following:
Coordinates to convert: 38.856147, -94.800953 Converted coordinates: [-94.800950, 0.000000]
The code works well on Simulator.
Does sombody have successful experience of using this function? May be we need to use different string format ?