Lat/long coord to pixel screen XY coord

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

Lat/long coord to pixel screen XY coord

Postby jmachete » Mon Jan 10, 2011 7:05 pm

Hi guys, I need to convert the lat/long coord to pixel xy coord to show a dot on the top of some image, I know I can use the following code inside MapView to do that conversion:

mapView.getProjection().toPixels(location.getPoint(), screenCoords);
int x=screenCoords.x;
int y=screenCoords.y;


however, I don't want to show or use the MapView, I just want to extract the X and Y screen coord, because I have my own background, my app will use a simple ImageView to display that background and I want to draw a little dot on canvas, on the top of that background, that dot will only appear if that location respect some range.

To better understand the question, imagine I have an aerial photo showing some building, I know the lat/long of that building, and I want to display a dot representing the building and a second dot if my actual position is near from that local.

How I can get the XY pixel screen position of that location without showing the MapView?
jmachete
Freshman
Freshman
 
Posts: 3
Joined: Mon Jan 10, 2011 6:40 pm

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 2 guests