1PJ_INIT(3U) PJ_INIT(3U)
2
3
4
6 pj_init - initialize cartographic projection
7 pj_init_plus - initialize cartographic projec‐
8 tion
9 pj_fwd - forward cartographic projection
10 pj_inv - inverse cartographic projection
11 pj_transform - transform between coordinate sys‐
12 tems
13 pj_free - de-initialize projection
14
16 #include <proj_api.h>
17
18 projPJ pj_init(int argc, char **argv)
19
20 projPJ pj_init_plus(const char *defn)
21
22 projUV pj_fwd(projUV val, projPJ proj)
23
24 projUV pj_inv(projUV val, projPJ proj)
25
26 int pj_transform(projPJ src_cs, projPJ dst_cs, long point_count,
27 int point_offset, double *x, double *y, double *z)
28
29 void pj_free(projPJ proj)
30
31
33 Procedure pj_init selects and initializes a car‐
34 tographic projection with its argument control
35 parameters. Argc is the number of elements in
36 the array of control strings argv that each con‐
37 tain individual cartographic control keyword as‐
38 signments (+ proj arguments). The list must
39 contain at least the proj=projection and Earth's
40 radius or elliptical parameters. If the ini‐
41 tialization of the projection is successful a
42 valid address is returned otherwise a NULL val‐
43 ue.
44
45 The pj_init_plus function operates similarly to
46 pj_init but takes a single string containing the
47 definition, with each parameter prefixed with a
48 plus sign. For example "+proj=utm +zone=11
49 +ellps=WGS84".
50
51 Once initialization is performed either forward
52 or inverse projections can be performed with the
53 returned value of pj_init used as the argument
54 proj. The argument structure projUV values u
55 and v contain respective longitude and latitude
56 or x and y. Latitude and longitude are in radi‐
57 ans. If a projection operation fails, both ele‐
58 ments of projUV are set to HUGE_VAL (defined in
59 math.h).
60
61 Note: all projections have a forward mode, but
62 some do not have an inverse projection. If the
63 projection does not have an inverse the projPJ
64 structure element inv will be NULL.
65
66 The pj_transform function may be used to trans‐
67 form points between the two provided coordinate
68 systems. In addition to converting between car‐
69 tographic projection coordinates and geographic
70 coordinates, this function also takes care of
71 datum shifts if possible between the source and
72 destination coordinate system. Unlike pj_fwd
73 and pj_inv it is also allowable for the coordi‐
74 nate system definitions (PJ *) to be geographic
75 coordinate systems (defined as +proj=latlong).
76 The x, y and z arrays contain the input values
77 of the points, and are replaced with the output
78 values. The point_offset should indicate the
79 spacing the of x,y,z arrays, normally 1. The
80 function returns zero on success, or the error
81 number (also in pj_errno) on failure.
82
83 Memory associated with the projection may be
84 freed with pj_free.
85
87 The following program reads latitude and longi‐
88 tude values in decimal degrees, performs Merca‐
89 tor projection with a Clarke 1866 ellipsoid and
90 a 33° latitude of true scale and prints the pro‐
91 jected cartesian values in meters:
92 #include <proj_api.h>
93
94 main(int argc, char **argv) {
95 char *args[] = { "proj=merc", "ellps=clrk66", "lat_ts=33" };
96 projUV p;
97 projPJ pj;
98
99 if (!(pj = pj_init(3, args)))
100 exit(1);
101 while (scanf("%lf %lf", &p.v, &p.u) == 2) {
102 p.u *= DEG_TO_RAD;
103 p.v *= DEG_TO_RAD;
104 p = pj_fwd(p, pj);
105 printf("%.2f\t%.2f\n", p.u, p.v);
106 }
107 exit(0);
108 }
109
111 libproj.a - library of projections and support
112 procedures
113
115 https://github.com/OSGeo/proj.4/wiki/ProjAPI,
116 proj(1),
117 Cartographic Projection Procedures for the UNIX
118 Environment—A User's Manual, (Evenden, 1990,
119 Open-file report 90-284).
120
122 A list of known bugs can found at
123 https://github.com/OSGeo/proj.4/issues where new
124 bug reports can be submitted too.
125
127 http://proj4.org/
128
129
130
131 2001/04/05 Rel. 4.4 PJ_INIT(3U)