OpenStreetMap MapView calculating screen position of overlay

Tutorials that use the MapActivity. Many using GPS functionality.

OpenStreetMap MapView calculating screen position of overlay

Postby mtalha » Wed Sep 21, 2011 4:24 pm

I am using the mapview.getProjection.toPixels(iGeoPoint, Point); function to calculate the screen position of the overlay item, but somehow the position is incorrect that it is too out of the screen width and height.

As an example the Geo Coordinates for San Francisco are 37.61666667 and -122.3833333 and I set the map centre to this position and it moves to SFO, but toPixels returns -89117 as x and -29602 as y, which is not correct, it should be some value greater than (0,0) LeftTop and and less than mapview.getWidth(), mapView.getHeight() which is the bottomRight.

Am I doing something wrong here?? In fact I have to draw text on the marker, so I need the positions.

Please help.

Kind Regards,
Once Poster
Once Poster
Posts: 1
Joined: Wed Sep 21, 2011 4:10 pm


Return to Map Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest