tags:

views:

46

answers:

1

HI all,

Client given me a particular area map image. Here i need to get the longitude and latitude of the location at the Touch point on the image.

Is there any way i can work on this issue. To get the location of touch point on the image programatically.

Thank you In advance

+2  A: 

You can really only do this with any accuracy on a MapView, where you can use the methods

GeoPoint fromPixels(int x,
                    int y)
Create a new GeoPoint from pixel coordinates relative to the top-left 
of the MapView that provided this PixelConverter. 

and

toPixels
android.graphics.Point toPixels(GeoPoint in,
                                android.graphics.Point out)
Converts the given GeoPoint to onscreen pixel coordinates, relative to 
the top-left of the MapView that provided this Projection. 

to transform lat/on to screen coordinates.

If it's a plain old .png the, as long as the view covers a small area (a few square miles only), you could interpolate the lat/lon at the corners to get an approximate value for the touch point. If it was a whole country, then you would have to apply a coordinate transformation to map from a flat Mercator projection to a curved surface.

NickT