[Proj] Programmatic conversion of SPCS to LatLon problem

Chris Bennett cbennett.acs at gmail.com
Thu Feb 14 12:26:55 PST 2008


Hi All,

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.

Thanks!

-Chris.


#include <stdio.h>
#include <projects.h>
int main(int argc, char **argv) {
    static char *parms[] = {
        "proj=lcc", "datum=NAD83",/*etc, from nad83:406*/,"no_defs" };
    static float coords[] = {1836389.3, 683713.9};
    PJ *ref;
    projUV data;

    int i; float x,y;
    if ( (ref = pj_init(sizeof(parms)/sizeof(char *), parms)) ) {
        data.u = coords[0]; data.v = coords[1];
        data = pj_inv(data, ref);
        if (data.u != HUGE_VAL) printf("%.3f\t%.3f\n", data.u, data.v);
        else printf("data conversion error.\n");
    }
    exit(0);
}

I get the same results no matter the coords:
-2.308, 0.759
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20080214/58387d0f/attachment.html>


More information about the Proj mailing list