Issue
In an android app, i would like to set geopoint from coordinates in the following format 50 27.858N,004 57.146E. I read on the the following thread how to convert coordinates to geoPoint format? that I just have to use:
new GeoPoint((int)(27.858*1E6),(int)(57.146*1E6));
except that this is sending me to Iran and the requested point is in belgium as you can see here: http://maps.google.com/maps?geocode=&q=50+27.858N,004+57.146E
Any help would be trully welcome, thanks in advance!
Solution
The figures you are using are Degrees minutes ie, 50 degrees + 27.858 mins, geopoint needs it in degrees which for that location are lat 50.464300, lng 4.952433. You can just convert these to integers to save doing a floating point calculation which would be :
new GeoPoint(5046430,4952433);
Each degree is split up into 60 parts, each part being 1/60 of a degree. These parts are called minutes so to convert 50 degrees 27.858mins, you would have 50 full degrees + 27.857 * 1/60 of a degree, (27.857 * 1/60 = 0.4643) so your lat is 50.46430.
Answered By - Kenny
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.