[OpenLayers-Dev] Re: Translate mousecoordinates and show them on page

Matt Priour mpriour at kestrelcomputer.com
Thu Jul 21 10:53:53 EDT 2011


First, the LonLat object you get from map.getLonLatFromViewPortPx is in the
map's coordinate system.
Second, I assume that you do have the proj defs loaded (which is an
important and often overlooked step for both practical and performance
reasons)
Third, the transform function modifies the object it transforms and returns
the same object it transformed, NOT a copy of it or a new object. So you're
just transfoming mousepos three times and then displaying the results of
that series of transformations.
You need to do:
mousepos.clone().transform(....)

That creates a new, cloned object with transformed coordinates.

Matt Priour
Kestrel Computer Consulting


--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Translate-mousecoordinates-and-show-them-on-page-tp6606425p6607088.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.


More information about the Dev mailing list