Hi All,<br><br>Can anyone tell me why the following code doesn't work (note pj_inv())? Note that 'proj -I +init=nad83:405 < coords.txt' does work. <br><br>Thanks!<br><br>-Chris.<br><br><br><span style="font-family: courier new,monospace;">#include <stdio.h></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">#include <projects.h></span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">int main(int argc, char **argv) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> static char *parms[] = {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> "proj=lcc",</span><span style="font-family: courier new,monospace;"> "datum=NAD83",</span><span style="font-family: courier new,monospace;">/*etc, from nad83:406*/,</span><span style="font-family: courier new,monospace;">"no_defs"</span><span style="font-family: courier new,monospace;"> };</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> static float coords[] = {</span><span style="font-family: courier new,monospace;">1836389.3, 683713.9</span><span style="font-family: courier new,monospace;">};</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> PJ *ref;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> projUV data;</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> int i; float x,y;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;"> if ( (ref = pj_init(sizeof(parms)/sizeof(char *), parms)) ) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;">data.u</span><span style="font-family: courier new,monospace;"> = coords[0]; </span><span style="font-family: courier new,monospace;">data.v</span><span style="font-family: courier new,monospace;"> = coords[1]; </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;">data = pj_inv(data, ref);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;">if (data.u != HUGE_VAL) printf("%.3f\t%.3f\n", data.u, data.v);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;"> </span><span style="font-family: courier new,monospace;">else printf("data conversion error.\n");</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;"> }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> exit(0);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">}<br><br>I get the same results no matter the coords:<br>-2.308, 0.759<br></span><br>