1PJ_INIT(3)                 Library Functions Manual                 PJ_INIT(3)
2
3
4

NAME

6       pj_init - initialize cartographic projection
7       pj_init_plus - initialize cartographic projection
8       pj_fwd - forward cartographic projection
9       pj_inv - inverse cartographic projection
10       pj_transform - transform between coordinate systems
11       pj_free - de-initialize projection
12

SYNOPSIS

14       #include <proj_api.h>
15
16       projPJ pj_init(int argc, char **argv)
17
18       projPJ pj_init_plus(const char *defn)
19
20       projUV pj_fwd(projUV val, projPJ proj)
21
22       projUV pj_inv(projUV val, projPJ proj)
23
24       int pj_transform(projPJ src_cs, projPJ dst_cs, long point_count,
25                        int point_offset, double *x, double *y, double *z)
26
27       void pj_free(projPJ proj)
28
29

DESCRIPTION

31       Procedure  pj_init  selects  and  initializes a cartographic projection
32       with its argument control parameters.  Argc is the number  of  elements
33       in  the array of control strings argv that each contain individual car‐
34       tographic control keyword assignments (+  proj  arguments).   The  list
35       must  contain at least the proj=projection and Earth's radius or ellip‐
36       tical parameters.  If the initialization of the projection is  success‐
37       ful a valid address is returned otherwise a NULL value.
38
39       The  pj_init_plus  function  operates  similarly to pj_init but takes a
40       single string containing the definition, with each  parameter  prefixed
41       with a plus sign.  For example "+proj=utm +zone=11 +ellps=WGS84".
42
43       Once  initialization is performed either forward or inverse projections
44       can be performed with the returned value of pj_init used as  the  argu‐
45       ment  proj.   The  argument structure projUV values u and v contain re‐
46       spective longitude and latitude or x and y.  Latitude and longitude are
47       in  radians.   If a projection operation fails, both elements of projUV
48       are set to HUGE_VAL (defined in math.h).
49
50       Note: all projections have a forward mode, but some do not have an  in‐
51       verse  projection.  If the projection does not have an inverse the pro‐
52       jPJ structure element inv will be NULL.
53
54       The pj_transform function may be used to transform points  between  the
55       two  provided  coordinate  systems.   In addition to converting between
56       cartographic projection coordinates and  geographic  coordinates,  this
57       function also takes care of datum shifts if possible between the source
58       and destination coordinate system.  Unlike pj_fwd and pj_inv it is also
59       allowable for the coordinate system definitions (PJ *) to be geographic
60       coordinate systems (defined as +proj=latlong).  The x, y and  z  arrays
61       contain  the input values of the points, and are replaced with the out‐
62       put values.  The point_offset should indicate the spacing the of  x,y,z
63       arrays, normally 1.  The function returns zero on success, or the error
64       number (also in pj_errno) on failure.
65
66       Memory associated with the projection may be freed with pj_free.
67

EXAMPLE

69       The following program reads latitude and longitude  values  in  decimal
70       degrees,  performs Mercator projection with a Clarke 1866 ellipsoid and
71       a 33° latitude of true scale and prints the projected cartesian  values
72       in meters:
73       #include <proj_api.h>
74
75       main(int argc, char **argv) {
76            char *args[] = { "proj=merc", "ellps=clrk66", "lat_ts=33" };
77            projUV p;
78            projPJ pj;
79
80            if (!(pj = pj_init(3, args)))
81               exit(1);
82            while (scanf("%lf %lf", &p.v, &p.u) == 2) {
83               p.u *= DEG_TO_RAD;
84               p.v *= DEG_TO_RAD;
85               p = pj_fwd(p, pj);
86               printf("%.2f\t%.2f\n", p.u, p.v);
87            }
88            exit(0);
89       }
90

LIBRARY

92       libproj.a - library of projections and support procedures
93

SEE ALSO

95       https://github.com/OSGeo/proj.4/wiki/ProjAPI, proj(1),
96       Cartographic  Projection  Procedures  for the UNIX Environment—A User's
97       Manual, (Evenden, 1990, Open-file report 90-284).
98

BUGS

100       A list of known bugs can found  at  https://github.com/OSGeo/proj.4/is
101       sues where new bug reports can be submitted too.
102

HOME PAGE

104       https://proj4.org/
105
106
107
108                             2018/09/5 Rel. 5.2.0                   PJ_INIT(3)
Impressum