Hi,

Also the name seems to suggest, that getLonLatFromViewPortPx will return
Worldcoordinates in lon, lat, it really returns the coordinates in map
units.

You have to transform your coordinates: 

var P900913 = new OpenLayers.Projection("EPSG:900913");
var P4326   = new OpenLayers.Projection("EPSG:4326");

trigger: function(e) { 
    var xyCoords = map_Obj.getLonLatFromViewPortPx(e.xy); 

    var lonlat = xyCoords.transform(P900913, P4326);

    alert("You clicked near " + lonlat.lat + ", " + lonlat.lon);

    ...

Arnd 

-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Arnie Shore
Gesendet: Montag, 31. Oktober 2011 00:03
An: [email protected]
Betreff: [OpenLayers-Users] Convert to Long, Lat?

I guess I missed something in the example at
http://openlayers.org/dev/examples/click.html

See my http://www.saefern.org/_osm/test6.php

Mebbe the noobie-est question so far, but how do I convert the displayed 
values to long, lat? (Line 48 there.)    Thanks, all.



_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to