<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 class="" style="white-space:pre">        </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 class="" style="white-space:pre">        </span>std::cout &lt;&lt; &quot;Lat: &quot;;</div><div><span class="" style="white-space:pre">        </span>double latitude;</div><div><span class="" style="white-space:pre">        </span>std::cin &gt;&gt; latitude;</div><div><span class="" style="white-space:pre">        </span>std::cout &lt;&lt; std::endl;</div><div><span class="" style="white-space:pre">        </span>std::cout &lt;&lt; &quot;Long: &quot;;</div><div><span class="" style="white-space:pre">        </span>double longitude;</div><div><span class="" style="white-space:pre">        </span>std::cin &gt;&gt; longitude;</div><div><br></div><div>    x = latitude*DEG_TO_RAD;</div><div><span class="" style="white-space:pre">        </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 class="" style="white-space:pre">        </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 class="" style="white-space:pre">        </span>printf(&quot;Lat/Long: %f/%f - in meters -&gt;: %f/%f\n&quot;, latitude, longitude, x, y);</div><div><br></div><div><span class="" style="white-space:pre">        </span>return 0;</div><div>}</div></div><div>***********************************************************************************************************<br></div></div>