Hi<br><br>pj_transform use lat/long coordinate in radian. So you have to convert them to degree with <span class="pln">"RAD_TO_DEG " defined at the value </span><span class="lit">57.29577951308232</span> in proj_api.h<br>
<br>Nicolas<br><br><div class="gmail_quote">2011/12/7 Cyril Bondue <span dir="ltr"><<a href="mailto:c.bondue@hotmail.com">c.bondue@hotmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div dir="ltr">
Hello fellow coders!<br><br>I'm writing to ask for your help. I need to convert data from NTF (Paris) / Lambert Centre France (epsg 27562) to WGS84 (epsg 4326). To test Proj4 I used the web interface Proj4js, and i could do the conversion without much troubles. Here are the two projPj I used, and working :<br>
- source : +proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=0 +k_0=0.99987742 +x_0=600000 +y_0=200000 +a=6378249.2 +b=6356515 +towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs<br> - dest : +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs<br>
Good! But I need to do the conversion in a C++ program, so I downloaded the source, downloaded the NAD for France (who were already in the archive BTW), compiled with MinGW (i'm doing a Windows software), compilation runs without problems, great!<br>
<br>Now, troubles ^^<br>Here is my code :<br><br>projPJ source = pj_init_plus("+proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=0 +k_0=0.99987742 +x_0=600000 +y_0=200000 +a=6378249.2 +b=6356515 +towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs");<br>
projPJ dest = pj_init_plus("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs");<br><br>double x = 535003.285368d;<br>double y = 200358.358412d;<br>pj_transform(source, dest, 1, 1, &x, &y, NULL);<br><br>pj_transform returns 0 (OK), but x and y are wrong. I have x=0.0259181 and y=0.816814 while the correct results are 1.485 and 46.8 (rounded up), results that Proj4Js confirms.<br>
I also tried the same transformation on cs2cs :<br>cs2cs.exe +proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=0 +k_0=0.99987742 +x_0=600000 +y_0=200000 +a=6378249.2 +b=6356 515 +towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs +to +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs<br>
535003.285368 200358.358412<br>Results are different and also wrong (or i can't read them right) x=1d29'6"E, y=46d48'N 44.005<br><br>I have taken care of settings PROJ_LIB with the nad folder. So i must do something wrong, i've tried many things but i don't understand what happens, so here I am, asking you for some assistance. Can you see what's going on?<br>
<br>Thank you in advance!<span class="HOEnZb"><font color="#888888"><br><br>Cyril<span style="font-family:'Courier';font-size:10pt;color:#000000"><br></span>                                            </font></span></div></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>