Search code examples
androidosmdroid

converting screen coordinates to geopoint


I'm trying to port an app from googlemap 2.2 to osmdroid 3.0.8. I'm stuck with the following code in my MapView:

Projection proj = getProjection();
GeoPoint topLeft = proj.fromPixels(0, 0);
GeoPoint bottomRight = proj.fromPixels(getWidth()-1, getHeight()-1);

With osmdroid, topLeft is always at north pole.

Is there a different way to handle that in OSM ?


Solution

  • In OsmDroid you use mapView.getScreenRect to find the top left of the screen.