Hello all.<br><br>Im trying to get the coordinates drawn by the drawfeature avaliable in the EditingToolbar in a google maps base layer-<br>I´ve created the map with the &quot;sphericalMercator: true,&quot; and im transforming the projection to get the coordinates.<br>
However the numbers returned are far from the truth and even NaN.<br><br>From what ive read its all about the projections and the transforms, but i cant get it to work.<br><br>Below is a working (returning the wrong coordinates) sample code.<br>
<br>Ill apreciate the help.<br><br>Thanks<br>Filipe<br><br><br>&lt;html&gt;<br>    &lt;head&gt;<br>        &lt;!-- OpenLayers core js --&gt;<br>        &lt;script type=&quot;text/javascript&quot; src=&quot;<a href="http://www.openlayers.org/dev/OpenLayers.js">http://www.openlayers.org/dev/OpenLayers.js</a>&quot;&gt;&lt;/script&gt;<br>
        &lt;!-- OpenStreetMap base layer js --&gt;<br>        &lt;script type=&quot;text/javascript&quot; src=&quot;<a href="http://www.openstreetmap.org/openlayers/OpenStreetMap.js">http://www.openstreetmap.org/openlayers/OpenStreetMap.js</a>&quot;&gt;&lt;/script&gt;<br>
        &lt;!-- Google Maps --&gt;<br>        &lt;script src=&quot;<a href="http://maps.google.com/maps/api/js?sensor=false">http://maps.google.com/maps/api/js?sensor=false</a>&quot;&gt;&lt;/script&gt;<br>        <br>        &lt;script type=&quot;text/javascript&quot;&gt;<br>
        function init() {<br>            //<br>            var proj = new OpenLayers.Projection(&quot;EPSG:4326&quot;);<br>            <br>            //Create map<br>            var map = new OpenLayers.Map(&#39;map&#39;);<br>
            //Add controls<br>            map.addControl(new OpenLayers.Control.LayerSwitcher());<br><br>            <br>            //base layer WITH sphericalMercator<br>            var gmap = new OpenLayers.Layer.Google(&quot;Google Streets&quot;, {<br>
                sphericalMercator: true,<br>                &#39;maxExtent&#39;: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34)<br>            });<br>            //Vector Layer<br>            var pointLayer = new OpenLayers.Layer.Vector(&quot;Point Layer&quot;);<br>
            <br>            //add layers<br>            map.addLayers([gmap, pointLayer]);<br>            <br>            //center map<br>            var lonlat = new OpenLayers.LonLat(16.373056, 48.208333);<br>            lonlat.transform(proj, map.getProjectionObject());<br>
            map.setCenter(lonlat, 5);<br><br>            //add feature<br>            var point = new OpenLayers.Geometry.Point(16.373056, 48.208333);<br>            point = point.transform(proj, map.getProjectionObject());<br>
            var pointFeature = new OpenLayers.Feature.Vector(point, null, null);<br>            pointLayer.addFeatures([pointFeature]);<br>            <br>            //add EditingToolbar<br>            map.addControl(new OpenLayers.Control.EditingToolbar(pointLayer));<br>
            <br>            //attach to events<br>            pointLayer.events.on({<br>                &quot;sketchcomplete&quot;: OpenLayers.Function.bind(report_1, this)<br>            });<br>            //callback function<br>
            function report_1(event) {<br>            <br>                var bounds = event.feature.geometry.getBounds();<br><br>                var ll = map.getLonLatFromPixel(new OpenLayers.Pixel(bounds.left, bounds.bottom));<br>
                var ur = map.getLonLatFromPixel(new OpenLayers.Pixel(bounds.right, bounds.top));<br>                <br>                ll = ll.transform(proj, map.getProjectionObject());<br>                ur = ur.transform(proj, map.getProjectionObject());<br>
                <br>                alert(ll.lon + &quot;, &quot; + ll.lat + &quot;, &quot; + ur.lon + &quot;, &quot; + ur.lat);<br>            }<br>        }<br>        &lt;/script&gt;<br>    &lt;/head&gt;<br>    &lt;body onload=&quot;init()&quot;&gt;<br>
        &lt;div id=&quot;map&quot; style=&quot;width:500px; height:500px;&quot;&gt;&lt;/div&gt;<br>        &lt;div id=&quot;coordinates&quot;&gt;&lt;/div&gt;<br>    &lt;/body&gt;<br>&lt;/html&gt;<br>