GRASS GIS 8 Programmer's Manual
8.2.2dev(2023)-3d2c704037
gprojects.h
Go to the documentation of this file.
1
/*
2
******************************************************************************
3
*
4
* MODULE: gproj library
5
* AUTHOR(S): Original Author unknown, probably Soil Conservation Service
6
* Paul Kelly
7
* PURPOSE: Include file for GRASS modules that use the PROJ.4
8
* wrapper functions
9
* COPYRIGHT: (C) 2003 by the GRASS Development Team
10
*
11
* This program is free software under the GNU General Public
12
* License (>=v2). Read the file COPYING that comes with GRASS
13
* for details.
14
*
15
*****************************************************************************/
16
17
#ifndef GRASS_GPROJECTS_H
18
#define GRASS_GPROJECTS_H
19
20
#include <
grass/config.h
>
21
/* TODO: clean up support for PROJ 5+ */
22
#ifdef HAVE_PROJ_H
23
#include <proj.h>
24
#define RAD_TO_DEG 57.295779513082321
25
#define DEG_TO_RAD .017453292519943296
26
27
/* adapted from gdal_version.h */
28
#ifndef PROJ_COMPUTE_VERSION
29
#define PROJ_COMPUTE_VERSION(maj,min,rev) ((maj)*1000000+(min)*10000+(rev)*100)
30
#endif
31
32
/* just in case PROJ introduces PROJ_VERSION_NUM in a future version */
33
#ifdef PROJ_VERSION_NUM
34
#undef PROJ_VERSION_NUM
35
#endif
36
#define PROJ_VERSION_NUM (PROJ_COMPUTE_VERSION(PROJ_VERSION_MAJOR,PROJ_VERSION_MINOR,PROJ_VERSION_PATCH))
37
38
#ifndef PJ_WKT2_LATEST
39
/* update if new PROJ versions support new WKT2 standards */
40
#if PROJ_VERSION_NUM < 6030000
41
#define PJ_WKT2_LATEST PJ_WKT2_2018
42
#else
43
#define PJ_WKT2_LATEST PJ_WKT2_2019
44
#endif
45
#endif
46
47
#else
48
#include <proj_api.h>
49
#define PJ_FWD 1
50
#define PJ_INV -1
51
/* PROJ_VERSION_MAJOR is not set in the old PROJ API */
52
#define PROJ_VERSION_MAJOR 4
53
#endif
54
#ifdef HAVE_OGR
55
# include <ogr_srs_api.h>
56
# if PROJ_VERSION_MAJOR >= 6 && GDAL_VERSION_MAJOR < 3
57
# error "PROJ 6+ requires GDAL 3+"
58
# endif
59
#endif
60
61
/* Data Files */
62
#define ELLIPSOIDTABLE "/etc/proj/ellipse.table"
63
#define DATUMTABLE "/etc/proj/datum.table"
64
#define DATUMTRANSFORMTABLE "/etc/proj/datumtransform.table"
65
/* GRASS relative location of datum conversion lookup tables */
66
#define GRIDDIR "/etc/proj/nad"
67
68
/* TODO: rename pj_ to gpj_ to avoid symbol clash with PROJ lib */
69
struct
pj_info
70
{
71
#ifdef HAVE_PROJ_H
72
PJ *
pj
;
73
#else
74
projPJ
pj
;
75
#endif
76
double
meters
;
77
int
zone
;
78
char
proj
[100];
79
char
*
def
;
80
char
*
srid
;
81
char
*
wkt
;
82
};
83
84
struct
gpj_datum
85
{
86
char
*
name
, *longname, *ellps;
87
double
dx, dy,
dz
;
88
};
89
90
/* no longer needed with PROJ6+ */
91
struct
gpj_datum_transform_list
92
{
93
94
int
count
;
/**< Transform Number (ordered list) */
95
96
char
*
params
;
/**< PROJ.4-style datum transform parameters */
97
98
char
*
where_used
;
/**< Comment text describing where (geographically)
99
* the transform is valid */
100
101
char
*
comment
;
/**< Additional Comments */
102
103
struct
gpj_datum_transform_list
*
next
;
/**< Pointer to next set of
104
* transform parameters in linked list */
105
};
106
107
struct
gpj_ellps
108
{
109
char
*
name
, *longname;
110
double
a, es, rf;
111
};
112
113
#ifndef HAVE_PROJ_H
114
/* PROJ.4's private datastructures copied from projects.h as removed
115
from upstream; pending better solution. see:
116
http://trac.osgeo.org/proj/ticket/98 */
117
118
/* In PROJ 5, the 'struct FACTORS' is back in as 'struct P5_FACTORS',
119
* and old 'struct LP' is now back in as 'PJ_UV' */
120
121
typedef
struct
{
double
u, v; } LP;
122
123
struct
DERIVS {
124
double
x_l, x_p;
/* derivatives of x for lambda-phi */
125
double
y_l, y_p;
/* derivatives of y for lambda-phi */
126
};
127
128
struct
FACTORS {
129
struct
DERIVS der;
130
double
h, k;
/* meridinal, parallel scales */
131
double
omega, thetap;
/* angular distortion, theta prime */
132
double
conv;
/* convergence */
133
double
s;
/* areal scale factor */
134
double
a,
b
;
/* max-min scale error */
135
int
code;
/* info as to analytics, see following */
136
};
137
/* end of copy */
138
#endif
139
140
#include <
grass/defs/gprojects.h
>
141
142
#endif
gpj_datum_transform_list
Definition:
gprojects.h:91
gprojects.h
pj_info::proj
char proj[100]
Definition:
gprojects.h:78
config.h
pj_info::zone
int zone
Definition:
gprojects.h:77
gpj_datum_transform_list::where_used
char * where_used
Definition:
gprojects.h:98
gpj_datum_transform_list::count
int count
Definition:
gprojects.h:94
pj_info::wkt
char * wkt
Definition:
gprojects.h:81
pj_info::pj
PJ * pj
Definition:
gprojects.h:72
gpj_ellps
Definition:
gprojects.h:107
gpj_datum::name
char * name
Definition:
gprojects.h:86
gpj_datum_transform_list::comment
char * comment
Definition:
gprojects.h:101
b
double b
Definition:
r_raster.c:39
gpj_datum
Definition:
gprojects.h:84
pj_info::def
char * def
Definition:
gprojects.h:79
gpj_datum_transform_list::params
char * params
Definition:
gprojects.h:96
gpj_ellps::name
char * name
Definition:
gprojects.h:109
pj_info::srid
char * srid
Definition:
gprojects.h:80
pj_info::meters
double meters
Definition:
gprojects.h:76
gpj_datum::dz
double dz
Definition:
gprojects.h:87
gpj_datum_transform_list::next
struct gpj_datum_transform_list * next
Definition:
gprojects.h:103
pj_info
Definition:
gprojects.h:69
include
grass
gprojects.h
Generated on Tue Feb 14 2023 05:55:59 for GRASS GIS 8 Programmer's Manual by
1.8.13