<div dir="ltr">Dear,<div><br></div><div>I thought the order long/lat or lat/long where defined using +proj=[longlat, latlong], anyway I have only tested without the zone number</div><div><br></div><div>Thanks a lot.</div><div><br></div><div>Charles.</div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-10-23 11:16 GMT+02:00 Jose Gonçalves <span dir="ltr">&lt;<a href="mailto:jagoncal@gmail.com" target="_blank">jagoncal@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hello<br><br></div>Two problems with your procedure:<br></div>- PROJ expects coordinates in the order long/lat and not lat/long<br></div>- You must specify the UTM zone number<br></div><br><div>echo 3.96338 51.0242 | cs2cs.exe +proj=latlong +ellps=WGS84 +to +proj=utm +ellps=WGS84 +datum=WGS84 +zone=31 +units=m<br>567564.16       5652957.63 0.00<br><div><br></div><div>Regards<br><br></div><div>José Gonçalves<br><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">2014-10-23 9:13 GMT+01:00 Charles Clercq <span dir="ltr">&lt;<a href="mailto:charles.clercq@gmail.com" target="_blank">charles.clercq@gmail.com</a>&gt;</span>:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Dear all,<div><br></div><div>I have written a simple basic code inspired from the doc to convert data in lat/long WGS84 in meters (UTM/WGS84)</div><div>My problem is that when I tested it with lat: 51.0242 / long: 3.96338 and obtained  x: 7627600.282316 / y: 742130.588781 which I compared with online converter which gave me : 5652958 / 567564</div><div><br></div><div>I would like to understand the error. I that because proj can&#39;t convert from WGS84 lat/long to UTM WGS84 ?</div><div><br></div><div>I tested with command line:</div><div><div>echo 51.0242 3.96338 | cs2cs.exe +proj=latlong +ellps=WGS84 +to +proj=utm +ellps=WGS84 +datum=WGS84 +units=m</div></div><div>and obtained the exact same result.</div><div><br></div><div>Any advice?</div><div><br></div><div>Thanks</div><div><br></div><div>Clercq</div><div><br></div><div>The code</div><div>***********************************************************************************************************</div><div><div>#include &lt;iostream&gt;</div><div><br></div><div>#include &lt;proj_api.h&gt;</div><div><br></div><div>int _tmain(int argc, _TCHAR* argv[])</div><div>{</div><div><span style="white-space:pre-wrap">        </span>projPJ pj_merc, pj_latlong;</div><div>    double x, y;</div><div><br></div><div>    if (!(pj_merc = pj_init_plus(&quot;+proj=utm +ellps=WGS84 +datum=WGS84 +units=m&quot;)) )</div><div>        exit(1);</div><div>    if (!(pj_latlong = pj_init_plus(&quot;+proj=latlong +ellps=WGS84&quot;)) )</div><div>        exit(1);</div><div><span style="white-space:pre-wrap">        </span>std::cout &lt;&lt; &quot;Lat: &quot;;</div><div><span style="white-space:pre-wrap">        </span>double latitude;</div><div><span style="white-space:pre-wrap">        </span>std::cin &gt;&gt; latitude;</div><div><span style="white-space:pre-wrap">        </span>std::cout &lt;&lt; std::endl;</div><div><span style="white-space:pre-wrap">        </span>std::cout &lt;&lt; &quot;Long: &quot;;</div><div><span style="white-space:pre-wrap">        </span>double longitude;</div><div><span style="white-space:pre-wrap">        </span>std::cin &gt;&gt; longitude;</div><div><br></div><div>    x = latitude*DEG_TO_RAD;</div><div><span style="white-space:pre-wrap">        </span>y = longitude*DEG_TO_RAD;</div><div><br></div><div>    int p = pj_transform(pj_latlong, pj_merc, 1, 1, &amp;x, &amp;y, NULL );</div><div><br></div><div><span style="white-space:pre-wrap">        </span>//std::cout &lt;&lt; &quot;The coordinate in meters are: &quot; &lt;&lt; x &lt;&lt; &quot;/&quot; &lt;&lt; y &lt;&lt; std::endl;</div><div><span style="white-space:pre-wrap">        </span>printf(&quot;Lat/Long: %f/%f - in meters -&gt;: %f/%f\n&quot;, latitude, longitude, x, y);</div><div><br></div><div><span style="white-space:pre-wrap">        </span>return 0;</div><div>}</div></div><div>***********************************************************************************************************<br></div></div>
<br></div></div>_______________________________________________<br>
Proj mailing list<br>
<a href="mailto:Proj@lists.maptools.org" target="_blank">Proj@lists.maptools.org</a><br>
<a href="http://lists.maptools.org/mailman/listinfo/proj" target="_blank">http://lists.maptools.org/mailman/listinfo/proj</a><br></blockquote></div><br></div>
<br>_______________________________________________<br>
Proj mailing list<br>
<a href="mailto:Proj@lists.maptools.org">Proj@lists.maptools.org</a><br>
<a href="http://lists.maptools.org/mailman/listinfo/proj" target="_blank">http://lists.maptools.org/mailman/listinfo/proj</a><br></blockquote></div><br></div>