Hi Phil,<div><br></div><div>It seems I misunderstood. So the lonLat.projection is setting the lonLat to the 900913 lat and lon right? and then when we use transform(), that is when we are converting it to 4326. So i did not need project.</div>

<div><br></div><div>                      var lonLat = evt.xy;</div><div>                      var proj = new OpenLayers.Projection("EPSG:4326");</div><div>                      var nlonLat = new OpenLayers.LonLat(panel.map.getLonLatFromViewPortPx(lonLat).lon, panel.map.getLonLatFromViewPortPx(lonLat).lat);</div>

<div>                      nlonLat.transform(panel.map.getProjectionObject(), panel.map.displayProjection);</div><div><br></div><div>Works great. </div><div><br></div><div>Thanks,</div><div>Smaran</div><div><br><div class="gmail_quote">

On Sun, Aug 26, 2012 at 6:13 PM, Phil Scadden <span dir="ltr"><<a href="mailto:p.scadden@gns.cri.nz" target="_blank">p.scadden@gns.cri.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

its very easy to do the transform in js, especially between 4326 and<br>
900913. eg<br>
                 var lonLat = this.map.getLonLatFromPixel(e.xy);<br>
                 if (this.map.displayProjection) {<br>
                     lonLat.transform(this.map.getProjectionObject(),<br>
                         this.map.displayProjection );<br>
                 }<br>
If you look at docs for LonLat, you will see the transform method. It<br>
needs two projection objects. Create one for 4326<br>
eg var p4326 = new OpenLayers.Projection("EPSG:4326");<br>
<br>
and then the other will be the map projection. Code might something like:<br>
var p4326 = new OpenLayers.Projection("EPSG:4326");<br>
lonLat = new OpenLayers.LonLat(lon,lat);<br>
lonLat.project(p4326,map.getProjectionObject());<br>
<br>
<br>
<br>
Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Thanks & Regards<div>Smaran Harihar</div><br>
</div>