[OpenLayers-Users] Converting the output of
getLonLatFromViewPortPx to spherical coordinates
Andreas Hocevar
ahocevar at opengeo.org
Wed Oct 7 03:41:27 EDT 2009
J. Brian Adams wrote:
> I have been trying to mimic the Click Event Example in which a single
> mouse click triggers an alert box showing the location of the click in
> spherical coordinates (degrees North and Ease.) In my code when I
> click on a location the alert box shows the coordinates not as degrees
> (ie. 40 N -76.2 E) but instead as location (4865946 N, -8482597 E)
>
> Since I need to access the data in spherical coordinates, how might I
> transform the result from what I assume is the epsg4326 projection
> coordinates to degrees?
>
Just configure EPSG:4326 as displayProjection of your map, so it looks
like this:
var map = new OpenLayers.Map("map", {
displayProjection: new OpenLayers.Projection("EPSG:4326")
});
Regards,
Andreas.
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list