map ZoomLevel and screen pixel ratio

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

map ZoomLevel and screen pixel ratio

Postby merlin3000 » Fri Dec 11, 2009 7:25 am


I'm trying to draw a radius in the map that matches the actual zoomlevel. I've seen several posts with ideas (and solutions) to calculate the distance between two points on a sphere and I realize I can use that to do what I want. But I've also noticed google already provides a static method Location.distanceBetween( lat1, long1, lat2, long2, results).

So my idea was, every time I need to adapt the radius to the zoomlevel, I get two pixel positions on the screen, convert them to geopoints and than get the distance between the two. Now I can relate that value to my radius size.

But I'm having a problem in getting the results from distanceBetween method. I've tried to use the direct values from getLatitudeE6(), etc. methods from the GeoPoints but it gives me gigantic distances. I've seen some people converting the latitude and longitude from a location to a geopoint (microdegrees), by multiplying it by 1E6, so I assumed that dividing the values returned by the getLatitudeE6(), etc methods by 1E6 would work in distanceBetween but the program simply stops running after the method executes with the divided values.

Am I doing something wrong? How can I convert the data from a GeoPoint so it is compatible with Location.distanceBetween(...)?

I'm really not getting something here :/ Thank you in advance.
Posts: 2
Joined: Fri Dec 11, 2009 6:47 am


Return to Map Problems

Who is online

Users browsing this forum: No registered users and 2 guests