Statistics
| Revision:

svn-gvsig-desktop / trunk / libraries / libjni-proj4 / src / pj_strerrno.c @ 7098

History | View | Annotate | Download (2.8 KB)

1
/* list of projection system pj_errno values */
2
#ifndef lint
3
static const char SCCSID[]="@(#)pj_strerrno.c        4.12   94/05/25 GIE REL";
4
#endif
5
#include <stdio.h>
6
#include <errno.h>
7
#include <string.h>
8
#include <projects.h>
9
        static char *
10
pj_err_list[] = {
11
        "no arguments in initialization list",        /*  -1 */
12
        "no options found in 'init' file",                /*  -2 */
13
        "no colon in init= string",                        /*  -3 */
14
        "projection not named",                                /*  -4 */
15
        "unknown projection id",                        /*  -5 */
16
        "effective eccentricity = 1.",                        /*  -6 */
17
        "unknown unit conversion id",                        /*  -7 */
18
        "invalid boolean param argument",                /*  -8 */
19
        "unknown elliptical parameter name",                /*  -9 */
20
        "reciprocal flattening (1/f) = 0",                /* -10 */
21
        "|radius reference latitude| > 90",                /* -11 */
22
        "squared eccentricity < 0",                        /* -12 */
23
        "major axis or radius = 0 or not given",        /* -13 */
24
        "latitude or longitude exceeded limits",        /* -14 */
25
        "invalid x or y",                                /* -15 */
26
        "improperly formed DMS value",                        /* -16 */
27
        "non-convergent inverse meridinal dist",        /* -17 */
28
        "non-convergent inverse phi2",                        /* -18 */
29
        "acos/asin: |arg| >1.+1e-14",                        /* -19 */
30
        "tolerance condition error",                        /* -20 */
31
        "conic lat_1 = -lat_2",                                /* -21 */
32
        "lat_1 >= 90",                                        /* -22 */
33
        "lat_1 = 0",                                        /* -23 */
34
        "lat_ts >= 90",                                        /* -24 */
35
        "no distance between control points",                /* -25 */
36
        "projection not selected to be rotated",        /* -26 */
37
        "W <= 0 or M <= 0",                                /* -27 */
38
        "lsat not in 1-5 range",                        /* -28 */
39
        "path not in range",                                /* -29 */
40
        "h <= 0",                                        /* -30 */
41
        "k <= 0",                                        /* -31 */
42
        "lat_0 = 0 or 90 or alpha = 90",                /* -32 */
43
        "lat_1=lat_2 or lat_1=0 or lat_2=90",                /* -33 */
44
        "elliptical usage required",                        /* -34 */
45
        "invalid UTM zone number",                        /* -35 */
46
        "arg(s) out of range for Tcheby eval",                /* -36 */
47
        "failed to find projection to be rotated",        /* -37 */
48
        "failed to load NAD27-83 correction file",          /* -38 */
49
        "both n & m must be spec'd and > 0",                /* -39 */
50
        "n <= 0, n > 1 or not specified",                /* -40 */
51
        "lat_1 or lat_2 not specified",                        /* -41 */
52
        "|lat_1| == |lat_2|",                                /* -42 */
53
        "lat_0 is pi/2 from mean lat",                        /* -43 */
54
        "unparseable coordinate system definition",        /* -44 */
55
        "geocentric transformation missing z or ellps",        /* -45 */
56
        "unknown prime meridian conversion id",                /* -46 */
57
};
58
        char *
59
pj_strerrno(int err) 
60
{
61
    static char note[50];
62

    
63
    if (err > 0)
64
#ifdef HAVE_STRERROR
65
        return strerror(err);
66
#else
67
    {   
68
        sprintf(note,"no system list, errno: %d\n", err);
69
        return note;
70
    }
71
#endif
72
    else if (err < 0) {
73
        int adjusted_err = - err - 1;
74
        if (adjusted_err < (sizeof(pj_err_list) / sizeof(char *)))
75
            return(pj_err_list[adjusted_err]);
76
        else
77
        {
78
            sprintf( note, "invalid projection system error (%d)",
79
                     err );
80
            return note;
81
        }
82
    } else
83
        return NULL;
84
}