-
Notifications
You must be signed in to change notification settings - Fork 2
/
geo_normalize.h
214 lines (167 loc) · 7.72 KB
/
geo_normalize.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
/******************************************************************************
* $Id: geo_normalize.h 1983 2011-03-10 02:10:00Z warmerdam $
*
* Project: libgeotiff
* Purpose: Include file related to geo_normalize.c containing Code to
* normalize PCS and other composite codes in a GeoTIFF file.
* Author: Frank Warmerdam, [email protected]
*
******************************************************************************
* Copyright (c) 1999, Frank Warmerdam
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
#ifndef GEO_NORMALIZE_H_INCLUDED
#define GEO_NORMALIZE_H_INCLUDED
#include <stdio.h>
#include "geotiff.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* \file geo_normalize.h
*
* Include file for extended projection definition normalization api.
*/
#define MAX_GTIF_PROJPARMS 10
/**
* Holds a definition of a coordinate system in normalized form.
*/
typedef struct {
/** From GTModelTypeGeoKey tag. Can have the values ModelTypeGeographic
or ModelTypeProjected. */
short Model;
/** From ProjectedCSTypeGeoKey tag. For example PCS_NAD27_UTM_zone_3N.*/
short PCS;
/** From GeographicTypeGeoKey tag. For example GCS_WGS_84 or
GCS_Voirol_1875_Paris. Includes datum and prime meridian value. */
short GCS;
/** From ProjLinearUnitsGeoKey. For example Linear_Meter. */
short UOMLength;
/** One UOMLength = UOMLengthInMeters meters. */
double UOMLengthInMeters;
/** The angular units of the GCS. */
short UOMAngle;
/** One UOMAngle = UOMLengthInDegrees degrees. */
double UOMAngleInDegrees;
/** Datum from GeogGeodeticDatumGeoKey tag. For example Datum_WGS84 */
short Datum;
/** Prime meridian from GeogPrimeMeridianGeoKey. For example PM_Greenwich
or PM_Paris. */
short PM;
/** Decimal degrees of longitude between this prime meridian and
Greenwich. Prime meridians to the west of Greenwich are negative. */
double PMLongToGreenwich;
/** Ellipsoid identifier from GeogELlipsoidGeoKey. For example
Ellipse_Clarke_1866. */
short Ellipsoid;
/** The length of the semi major ellipse axis in meters. */
double SemiMajor;
/** The length of the semi minor ellipse axis in meters. */
double SemiMinor;
/** TOWGS84 transformation values (0/3/7) */
short TOWGS84Count;
/** TOWGS84 transformation values */
double TOWGS84[7];
/** Projection id from ProjectionGeoKey. For example Proj_UTM_11S. */
short ProjCode;
/** EPSG identifier for underlying projection method. From the EPSG
TRF_METHOD table. */
short Projection;
/** GeoTIFF identifier for underlying projection method. While some of
these values have corresponding vlaues in EPSG (Projection field),
others do not. For example CT_TransverseMercator. */
short CTProjection;
/** Number of projection parameters in ProjParm and ProjParmId. */
int nParms;
/** Projection parameter value. The identify of this parameter
is established from the corresponding entry in ProjParmId. The
value will be measured in meters, or decimal degrees if it is a
linear or angular measure. */
double ProjParm[MAX_GTIF_PROJPARMS];
/** Projection parameter identifier. For example ProjFalseEastingGeoKey.
The value will be 0 for unused table entries. */
int ProjParmId[MAX_GTIF_PROJPARMS]; /* geokey identifier,
eg. ProjFalseEastingGeoKey*/
/** Special zone map system code (MapSys_UTM_South, MapSys_UTM_North,
MapSys_State_Plane or KvUserDefined if none apply. */
int MapSys;
/** UTM, or State Plane Zone number, zero if not known. */
int Zone;
/** Do we have any definition at all? 0 if no geokeys found */
int DefnSet;
} GTIFDefn;
int CPL_DLL GTIFGetPCSInfo( int nPCSCode, char **ppszEPSGName,
short *pnProjOp,
short *pnUOMLengthCode, short *pnGeogCS );
int CPL_DLL GTIFGetProjTRFInfo( int nProjTRFCode,
char ** ppszProjTRFName,
short * pnProjMethod,
double * padfProjParms );
int CPL_DLL GTIFGetGCSInfo( int nGCSCode, char **ppszName,
short *pnDatum, short *pnPM, short *pnUOMAngle );
int CPL_DLL GTIFGetDatumInfo( int nDatumCode, char **ppszName,
short * pnEllipsoid );
int CPL_DLL GTIFGetEllipsoidInfo( int nEllipsoid, char ** ppszName,
double * pdfSemiMajor,
double * pdfSemiMinor );
int CPL_DLL GTIFGetPMInfo( int nPM, char **ppszName,
double * pdfLongToGreenwich );
double CPL_DLL GTIFAngleStringToDD( const char *pszAngle, int nUOMAngle );
int CPL_DLL GTIFGetUOMLengthInfo( int nUOMLengthCode,
char **ppszUOMName,
double * pdfInMeters );
int CPL_DLL GTIFGetUOMAngleInfo( int nUOMAngleCode,
char **ppszUOMName,
double * pdfInDegrees );
double CPL_DLL GTIFAngleToDD( double dfAngle, int nUOMAngle );
/* this should be used to free strings returned by GTIFGet... funcs */
void CPL_DLL GTIFFreeMemory( char * );
void CPL_DLL GTIFDeaccessCSV( void );
int CPL_DLL GTIFGetDefn( GTIF *psGTIF, GTIFDefn * psDefn );
void CPL_DLL GTIFPrintDefn( GTIFDefn *, FILE * );
void CPL_DLL GTIFFreeDefn( GTIF * );
void CPL_DLL SetCSVFilenameHook( const char *(*CSVFileOverride)(const char *) );
const char CPL_DLL *GTIFDecToDMS( double, const char *, int );
/*
* These are useful for recognising UTM and State Plane, with or without
* CSV files being found.
*/
#define MapSys_UTM_North -9001
#define MapSys_UTM_South -9002
#define MapSys_State_Plane_27 -9003
#define MapSys_State_Plane_83 -9004
int CPL_DLL GTIFMapSysToPCS( int MapSys, int Datum, int nZone );
int CPL_DLL GTIFMapSysToProj( int MapSys, int nZone );
int CPL_DLL GTIFPCSToMapSys( int PCSCode, int * pDatum, int * pZone );
int CPL_DLL GTIFProjToMapSys( int ProjCode, int * pZone );
/*
* These are only useful if using libgeotiff with libproj (PROJ.4+).
*/
char CPL_DLL *GTIFGetProj4Defn( GTIFDefn * );
int CPL_DLL GTIFProj4ToLatLong( GTIFDefn *, int, double *, double * );
int CPL_DLL GTIFProj4FromLatLong( GTIFDefn *, int, double *, double * );
int CPL_DLL GTIFSetFromProj4( GTIF *gtif, const char *proj4 );
#if defined(HAVE_LIBPROJ) && defined(HAVE_PROJECTS_H)
# define HAVE_GTIFPROJ4
#endif
#ifdef __cplusplus
}
#endif
#endif /* ndef GEO_NORMALIZE_H_INCLUDED */