hi,<br>I guess you need to transform the coords from 900913 system to 4326, don&#39;t you?<br><br>I am not an expert but I think you just need to use the transform function.<br>firt get a var called yourcoords (in the example I wrote) with the coordenate you want to transform.<br>
<br>Then do the transform.. like this.<br><br>newcoords = yourcoords.transform(new OpenLayers.Projection(&quot;EPSG:900913&quot;),new OpenLayers.Projection(&quot;4326&quot;))<br><br>900913 and 4326 are defined (I think) in Openlayers. If this is not working then you can try to do the transform with the proj4js api. If you do, read first this. <a href="http://trac.osgeo.org/proj4js/wiki/UserGuide">http://trac.osgeo.org/proj4js/wiki/UserGuide</a><br>
<br><div class="gmail_quote">On Sun, Jun 21, 2009 at 11:35 AM, Jan Martin <span dir="ltr">&lt;<a href="mailto:janmartin3@googlemail.com">janmartin3@googlemail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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" target="_blank">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 &quot;data.txt&quot;.<br><br>I think &quot;All I DID&quot; is changing from WMS to OSM Layers?<br>How to automatically convert?<br><br>Thanks.<br>


<br>Please find my code:<br><br>&lt;html&gt;<br>&lt;head&gt;<br>&lt;title&gt;map3&lt;/title&gt;<br>    &lt;style type=&quot;text/css&quot;&gt;<br>        #map {        width: 90%;<br>                height: 90%;<br>                border: 1px solid black;}<br>


    &lt;/style&gt;<br><br>&lt;script src=&quot;OpenLayers.js&quot;&gt;&lt;/script&gt;<br>&lt;script src=&quot;OpenStreetMap.js&quot;&gt;&lt;/script&gt;<br><br>        &lt;script type=&quot;text/javascript&quot;&gt;<br>            OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {                <br>


                defaultHandlerOptions: {<br>                    &#39;single&#39;: true,<br>                    &#39;double&#39;: false,<br>                    &#39;pixelTolerance&#39;: 0,<br>                    &#39;stopSingle&#39;: false,<br>


                    &#39;stopDouble&#39;: 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>                            &#39;click&#39;: this.trigger<br>                        }, this.handlerOptions<br>                    );<br>                }, <br><br>                trigger: function(e) {<br>


                var lonlat = map.getLonLatFromViewPortPx(e.xy);<br>                    alert(&quot;You clicked: &quot; + lonlat.lat  + &quot;   &quot; + lonlat.lon);<br>                }<br><br>            });<br><br>                var map;<br>


                function init() {<br>                        map = new OpenLayers.Map (&quot;map&quot;, {<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(&quot;Mapnik&quot;);<br>                        map.addLayer(layerMapnik,{layers: &#39;basic&#39;});<br>                        layerTilesAtHome = new OpenLayers.Layer.OSM.Osmarender(&quot;Osmarender&quot;);<br>


                        map.addLayer(layerTilesAtHome);<br>                        layerCycleMap = new OpenLayers.Layer.OSM.CycleMap(&quot;CycleMap&quot;);<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( &quot;text&quot;, {<br>                        location: &quot;data.txt&quot;,<br>                        } );<br>                        newl.events.register(&quot;loadend&quot;, newl, setExtent);<br>                        map.addLayer(newl);<br>                        map.setCenter(null, null);<br>


                        };<br>&lt;/script&gt;<br>&lt;/head&gt;<br><br>&lt;body onload=&quot;init();&quot;&gt;<br>&lt;div id=&quot;map&quot;&gt;&lt;/div&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;<br><br></pre><br>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
<br></blockquote></div><br>