<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-15">
<META content="MSHTML 6.00.2900.3243" name=GENERATOR></HEAD>
<BODY>
<DIV>Hi Steve</DIV>
<DIV>&nbsp;</DIV>
<DIV>This is what I do:</DIV>
<DIV>&nbsp;</DIV>
<DIV>include EPSG files specifically as required:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&lt;script src='OpenLayers.js'&gt;&lt;/script&gt;<BR>&nbsp;&lt;script src="lib/proj4js-combined.js"&gt;&lt;/script&gt;<BR>&nbsp;&lt;script src="lib/EPSG2193.js"&gt;&lt;/script&gt;<BR>&nbsp;&lt;script src="lib/EPSG27200.js"&gt;&lt;/script&gt;<BR>&nbsp;&lt;script src="lib/EPSG4326.js"&gt;&lt;/script&gt;<BR>&nbsp;&lt;script type="text/javascript"&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Later, I have code that retrieves the entered coordinates and converts:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var src = new OpenLayers.Projection('EPSG:4326');<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var dest = new OpenLayers.Projection('EPSG:2193');<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; latitude = document.getElementById('lat').value;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; longitude = document.getElementById('llong').value;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var markergeom = new OpenLayers.Geometry.Point(longitude,latitude);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //now in-place re-projection<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OpenLayers.Projection.transform(markergeom, src, dest); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpsx = markergeom.x;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpsy = markergeom.y;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert(gpsx + "," + gpsy);</DIV>
<DIV>&nbsp;</DIV>
<DIV>Cheers,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Robert Sanson<BR><BR>&gt;&gt;&gt; &lt;Steve.Toutant@inspq.qc.ca&gt; 17/03/2009 8:45 a.m. &gt;&gt;&gt;<BR><BR><FONT face=sans-serif size=2>I created a simple html page where the user enter lat/long coordinates and the program returns the projected coord in EPSG 32198.</FONT> <BR><BR><FONT face=sans-serif size=2>That works well, but if I insert the same code in a more complex program using openlayers, the coordinates are not projected. Here is the code I put just after map.setCenter()</FONT> <BR><BR><FONT face=sans-serif size=2>var lon = -70.894826;</FONT> <BR><FONT face=sans-serif size=2>var lat = 48.329377;</FONT> <BR><FONT face=sans-serif size=2>var point = new OpenLayers.Geometry.Point(lon, lat); </FONT><BR><FONT face=sans-serif size=2>var src = new OpenLayers.Projection('EPSG:4326'); </FONT><BR><FONT face=sans-serif size=2>OpenLayers.Projection.transform(point, src, map.getProjectionObject()); </FONT><BR><FONT face=sans-serif size=2>alert(point);</FONT> <BR><BR><FONT face=sans-serif size=2>I included the script at the beginning of my program</FONT> <BR><FONT face=sans-serif size=2>&lt;script src="../../proj4js/lib/proj4js-compressed.js"&gt;&lt;/script&gt;</FONT> <BR><BR><FONT face=sans-serif size=2>It seems that that the proj4js script is not found.</FONT> <BR><FONT face=sans-serif size=2>Any idea?</FONT> <BR><BR><FONT face=sans-serif size=2>thanks</FONT> <BR><FONT face=sans-serif size=2>Steve</FONT><BR><BR></DIV><FONT style="BACKGROUND-COLOR: #ffffff">
<P align=center><FONT style="BACKGROUND-COLOR: #ffffff">Click <A href="https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg==">here</A> to report this email as spam.</FONT></P></FONT><br><br><table bgcolor=white style="color:black"><tr><td><br>------------------------------------------------------------------<br>
The&nbsp;contents&nbsp;of&nbsp;this&nbsp;email&nbsp;are&nbsp;confidential&nbsp;to&nbsp;AsureQuality.&nbsp;If&nbsp;you&nbsp;have&nbsp;received&nbsp;this&nbsp;communication&nbsp;in&nbsp;error&nbsp;please&nbsp;notify&nbsp;the&nbsp;sender&nbsp;immediately&nbsp;and&nbsp;delete&nbsp;the&nbsp;message&nbsp;and&nbsp;any&nbsp;attachments.&nbsp;The&nbsp;opinions&nbsp;expressed&nbsp;in&nbsp;this&nbsp;email&nbsp;are&nbsp;not&nbsp;necessarily&nbsp;those&nbsp;of&nbsp;AsureQuality.&nbsp;This&nbsp;message&nbsp;has&nbsp;been&nbsp;scanned&nbsp;for&nbsp;known&nbsp;viruses&nbsp;before&nbsp;delivery.&nbsp;AsureQuality&nbsp;supports&nbsp;the&nbsp;Unsolicited&nbsp;Electronic&nbsp;Messages&nbsp;Act&nbsp;2007.&nbsp;If&nbsp;you&nbsp;do&nbsp;not&nbsp;wish&nbsp;to&nbsp;receive&nbsp;similar&nbsp;communications&nbsp;in&nbsp;future,&nbsp;please&nbsp;notify&nbsp;the&nbsp;sender&nbsp;of&nbsp;this&nbsp;message.<br>
------------------------------------------------------------------</td></tr></table><br><br>
<P align=center><FONT style="BACKGROUND-COLOR: #ffffff">This message has been scanned for malware by SurfControl plc.  </FONT><A href="http://www.surfcontrol.com/"><FONT style="BACKGROUND-COLOR: #ffffff" color=#000000>www.surfcontrol.com</FONT></A></P>
</body></HTML>