Hi all,<br>I have been fiddling with this way too long already, so I ask:<br><br>After changing the Click Event Example a bit I am getting coordinates like this:<br>
<br>
5383153.349692758 1323087.0961396247<br><br> Click Event Example: <a href="http://www.openlayers.org/dev/examples/click.html">http://www.openlayers.org/dev/examples/click.html</a><br><br>However I need them like this:<br>
<pre>43.468243 11.880172<br><br>Btw. same format as the coordinates in the "data.txt".<br><br>I think "All I DID" is changing from WMS to OSM Layers?<br>How to automatically convert?<br><br>Thanks.<br>
<br>Please find my code:<br><br><html><br><head><br><title>map3</title><br> <style type="text/css"><br> #map {        width: 90%;<br>                height: 90%;<br>                border: 1px solid black;}<br>
</style><br><br><script src="OpenLayers.js"></script><br><script src="OpenStreetMap.js"></script><br><br>        <script type="text/javascript"><br> OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { <br>
defaultHandlerOptions: {<br> 'single': true,<br> 'double': false,<br> 'pixelTolerance': 0,<br> 'stopSingle': false,<br>
'stopDouble': false<br> },<br><br> initialize: function(options) {<br> this.handlerOptions = OpenLayers.Util.extend(<br> {}, this.defaultHandlerOptions<br>
);<br> OpenLayers.Control.prototype.initialize.apply(<br> this, arguments<br> ); <br> this.handler = new OpenLayers.Handler.Click(<br>
this, {<br> 'click': this.trigger<br> }, this.handlerOptions<br> );<br> }, <br><br> trigger: function(e) {<br>
var lonlat = map.getLonLatFromViewPortPx(e.xy);<br> alert("You clicked: " + lonlat.lat + " " + lonlat.lon);<br> }<br><br> });<br><br>                var map;<br>
                function init() {<br>                        map = new OpenLayers.Map ("map", {<br>                                controls:[<br>                                        new OpenLayers.Control.Navigation(),<br>                                        new OpenLayers.Control.PanZoomBar(),<br>                                        new OpenLayers.Control.LayerSwitcher(),<br>
                                        ],<br>                        } );<br><br>                        layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik");<br>                        map.addLayer(layerMapnik,{layers: 'basic'});<br>                        layerTilesAtHome = new OpenLayers.Layer.OSM.Osmarender("Osmarender");<br>
                        map.addLayer(layerTilesAtHome);<br>                        layerCycleMap = new OpenLayers.Layer.OSM.CycleMap("CycleMap");<br>                        map.addLayer(layerCycleMap);<br><br> var click = new OpenLayers.Control.Click();<br> map.addControl(click);<br>
click.activate();<br><br>                var dataExtent;<br>                var setExtent = function() {<br>                        if(dataExtent) {dataExtent.extend(this.getDataExtent());} <br>                        else {dataExtent = this.getDataExtent();}<br>                        map.zoomToExtent(dataExtent);<br>
                };<br><br>                        var newl = new OpenLayers.Layer.Text( "text", {<br>                        location: "data.txt",<br>                        } );<br>                        newl.events.register("loadend", newl, setExtent);<br>                        map.addLayer(newl);<br>                        map.setCenter(null, null);<br>
                        };<br></script><br></head><br><br><body onload="init();"><br><div id="map"></div><br></body><br></html><br><br></pre><br>