[OpenLayers-Users] latLon from location on the screen?

Robert Sanson Robert.Sanson at asurequality.com
Mon Apr 4 17:21:15 EDT 2011


Hi
 
Use getLonLatFromViewPortPx():
 
 var xys = map.getLonLatFromViewPortPx(e.xy);
                  easting = xys.lon;
                  northing = xys.lat;
Regards,
 
Robert Sanson

>>> ulao <S_K_U_N_X at yahoo.com> 5/04/2011 2:27 a.m. >>>
either I have something bad wrong here or I dont understand
getLonLatFromPixel. In my mind this should give the corresponding lat and
lon from the current view of the map. In other words if my mouse is over NY
City, then I should get that lat and lon to NY City. It would seem that
200,200 ( x,y ) converts to the map off set of 200,200 instead of the
location of my screen. Its like the map goes oo the 0,0 point of the map and
adds 200 to X and 200 to Y and gave me the lat lon of that position. 

for example if I'm looking at the map and tell it to draw an object at
200,200 then I move the map and tell it to draw another, both objects are at
the same position? In my mind, moving the map should have place the objects
at different location. since 200,200 was not over the same location both
time.

Its like I need a screen location to latlon conversion. That or the function
is busted?

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/latLon-from-location-on-the-screen-tp6238783p6238783.html 
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at lists.osgeo.org 
http://lists.osgeo.org/mailman/listinfo/openlayers-users


This email and any attachments are confidential and intended solely for the addressee(s). If you are not the intended recipient, please notify us immediately and then delete this email from your system.

This message has been scanned for Malware and Viruses by Websense Hosted Security.
www.websense.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110405/d3ba08bc/attachment.html


More information about the Users mailing list