Getting Latitute/Longitude from x/y screen-pixel pair ?

Put your problem here if it does not fit any of the other categories.

Getting Latitute/Longitude from x/y screen-pixel pair ?

Postby abarinoff » Mon Dec 24, 2007 1:28 pm

An Android's Overlay.PixelCalculator class provides possibility to convert a lat/lon pair to an x/y screen-pixel pair. Does anyone know whether there is a utility that performs backward conversion ?
abarinoff
Freshman
Freshman
 
Posts: 3
Joined: Mon Dec 24, 2007 1:24 pm

Top

Postby plusminus » Mon Dec 24, 2007 2:39 pm

Hello abarinoff,

Im not 100% sure if the two functions provided by MapView are what you are searching for ( MapViewgetLatitudeSpan() and MapView.getLongitudeSpan() ).

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public int getLatitudeSpan()
  2. public int getLongitudeSpan()
Parsed in 0.029 seconds, using GeSHi 1.0.8.4


Merry Christmas,
plusminus :xmas:
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby abarinoff » Mon Dec 24, 2007 3:19 pm

plusminus wrote:Hello abarinoff,

Im not 100% sure if the two functions provided by MapView are what you are searching for ( MapViewgetLatitudeSpan() and MapView.getLongitudeSpan() ).

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public int getLatitudeSpan()
  2. public int getLongitudeSpan()
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


Merry Christmas,
plusminus :xmas:


I'm not sure whether those two methods will be helpful for me, I think the best choice for me would me MapPoint.pixelOffset() method.

Guys, please help, I got stuck with determining of x/y coordinates of center of device's screen. Is there a way to determine from MapView ? I can get map center Point with getMapCenter() method, but i didn't find a way to convert this Point to display's XY coordinates because I can't get access to Overlay.PixelCalculator from inside of MapView :(
abarinoff
Freshman
Freshman
 
Posts: 3
Joined: Mon Dec 24, 2007 1:24 pm

Postby plusminus » Tue Dec 25, 2007 12:16 am

Hello abarinoff,

what about getWidth() / 2 :?:
There probably is also sth. like getPositionOnScreen() or getLocationOnScreen() ...

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 11 guests