Debian Codegraph @

frmts/gtiff/libgeotiff/geo_normalize.h

raw
1 /******************************************************************************
2 *
3 * Project: libgeotiff
4 * Purpose: Include file related to geo_normalize.c containing Code to
5 * normalize PCS and other composite codes in a GeoTIFF file.
6 * Author: Frank Warmerdam, [email protected]
7 *
8 ******************************************************************************
9 * Copyright (c) 1999, Frank Warmerdam
10 *
11 * SPDX-License-Identifier: MIT
12 *****************************************************************************/
13
14 #ifndef GEO_NORMALIZE_H_INCLUDED
15 #define GEO_NORMALIZE_H_INCLUDED
16
17 #include <stdio.h>
18 #include "geotiff.h"
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 /**
25 * \file geo_normalize.h
26 *
27 * Include file for extended projection definition normalization api.
28 */
29
30 #define MAX_GTIF_PROJPARMS 10
31
32 /**
33 * Holds a definition of a coordinate system in normalized form.
34 */
35
36 typedef struct {
37 /** From GTModelTypeGeoKey tag. Can have the values ModelTypeGeographic
38 or ModelTypeProjected. */
39 short Model;
40
41 /** From ProjectedCSTypeGeoKey tag. For example PCS_NAD27_UTM_zone_3N.*/
42 short PCS;
43
44 /** From GeographicTypeGeoKey tag. For example GCS_WGS_84 or
45 GCS_Voirol_1875_Paris. Includes datum and prime meridian value. */
46 short GCS;
47
48 /** From ProjLinearUnitsGeoKey if found, or from GeogLinearUnitsGeoKey otherwise. For example Linear_Meter. */
49 short UOMLength;
50
51 /** One UOMLength = UOMLengthInMeters meters. */
52 double UOMLengthInMeters;
53
54 /** The angular units of the GCS. */
55 short UOMAngle;
56
57 /** One UOMAngle = UOMLengthInDegrees degrees. */
58 double UOMAngleInDegrees;
59
60 /** Datum from GeogGeodeticDatumGeoKey tag. For example Datum_WGS84 */
61 short Datum;
62
63 /** Prime meridian from GeogPrimeMeridianGeoKey. For example PM_Greenwich
64 or PM_Paris. */
65 short PM;
66
67 /** Decimal degrees of longitude between this prime meridian and
68 Greenwich. Prime meridians to the west of Greenwich are negative. */
69 double PMLongToGreenwich;
70
71 /** Ellipsoid identifier from GeogELlipsoidGeoKey. For example
72 Ellipse_Clarke_1866. */
73 short Ellipsoid;
74
75 /** The length of the semi major ellipse axis in meters. */
76 double SemiMajor;
77
78 /** The length of the semi minor ellipse axis in meters. */
79 double SemiMinor;
80
81 /* This #if is primary intended to maintain binary compatibility with older
82 versions of libgeotiff for MrSID binaries (for example). */
83 #if !defined(GEO_NORMALIZE_DISABLE_TOWGS84)
84 /** TOWGS84 transformation values (0/3/7) */
85 short TOWGS84Count;
86
87 /** TOWGS84 transformation values */
88 double TOWGS84[7];
89 #endif /* !defined(GEO_NORMALIZE_DISABLE_TOWGS84) */
90
91 /** Projection id from ProjectionGeoKey. For example Proj_UTM_11S. */
92 short ProjCode;
93
94 /** EPSG identifier for underlying projection method. From the EPSG
95 TRF_METHOD table. */
96 short Projection;
97
98 /** GeoTIFF identifier for underlying projection method. While some of
99 these values have corresponding values in EPSG (Projection field),
100 others do not. For example CT_TransverseMercator. */
101 short CTProjection;
102
103 /** Number of projection parameters in ProjParm and ProjParmId. */
104 int nParms;
105
106 /** Projection parameter value. The identify of this parameter
107 is established from the corresponding entry in ProjParmId.
108 In GeoTIFF keys, the values of the projection parameters are expressed
109 in the units of ProjLinearUnitsGeoKey (for linear measures) or
110 GeogAngularUnitsGeoKey (for angular measures).
111 However, the value returned in ProjParam[] will be normalized to meters
112 or decimal degrees.
113 Note: until libgeotiff 1.7.3, the conversion to degrees for angular
114 measures was *not* done when ProjCoordTransGeoKey is present.
115 */
116 double ProjParm[MAX_GTIF_PROJPARMS];
117
118 /** Projection parameter identifier. For example ProjFalseEastingGeoKey.
119 The value will be 0 for unused table entries. */
120 int ProjParmId[MAX_GTIF_PROJPARMS]; /* geokey identifier,
121 eg. ProjFalseEastingGeoKey*/
122
123 /** Special zone map system code (MapSys_UTM_South, MapSys_UTM_North,
124 MapSys_State_Plane or KvUserDefined if none apply. */
125 int MapSys;
126
127 /** UTM, or State Plane Zone number, zero if not known. */
128 int Zone;
129
130 /** Do we have any definition at all? 0 if no geokeys found */
131 int DefnSet;
132
133 } GTIFDefn;
134
135 int GTIF_DLL GTIFGetPCSInfoEx( void* ctx, /* The void* should be a PJ_CONTEXT* */
136 int nPCSCode, char **ppszEPSGName,
137 short *pnProjOp, short *pnUOMLengthCode,
138 short *pnGeogCS );
139 int GTIF_DLL GTIFGetPCSInfo( int nPCSCode, char **ppszEPSGName,
140 short *pnProjOp,
141 short *pnUOMLengthCode, short *pnGeogCS );
142
143 int GTIF_DLL GTIFGetProjTRFInfoEx( void* ctx, /* The void* should be a PJ_CONTEXT* */
144 int nProjTRFCode,
145 char **ppszProjTRFName,
146 short * pnProjMethod,
147 double * padfProjParams );
148 int GTIF_DLL GTIFGetProjTRFInfo( int nProjTRFCode,
149 char ** ppszProjTRFName,
150 short * pnProjMethod,
151 double * padfProjParams );
152
153 int GTIF_DLL GTIFGetGCSInfoEx( void* ctx, /* The void* should be a PJ_CONTEXT* */
154 int nGCSCode, char ** ppszName,
155 short * pnDatum, short * pnPM, short *pnUOMAngle );
156 int GTIF_DLL GTIFGetGCSInfo( int nGCSCode, char **ppszName,
157 short *pnDatum, short *pnPM, short *pnUOMAngle );
158
159 int GTIF_DLL GTIFGetDatumInfoEx( void* ctx, /* The void* should be a PJ_CONTEXT* */
160 int nDatumCode, char ** ppszName, short * pnEllipsoid );
161 int GTIF_DLL GTIFGetDatumInfo( int nDatumCode, char **ppszName,
162 short * pnEllipsoid );
163
164 int GTIF_DLL GTIFGetEllipsoidInfoEx( void* ctx, /* The void* should be a PJ_CONTEXT* */
165 int nEllipseCode, char ** ppszName,
166 double * pdfSemiMajor, double * pdfSemiMinor );
167 int GTIF_DLL GTIFGetEllipsoidInfo( int nEllipsoid, char ** ppszName,
168 double * pdfSemiMajor,
169 double * pdfSemiMinor );
170
171 int GTIF_DLL GTIFGetPMInfoEx( void* ctx, /* The void* should be a PJ_CONTEXT* */
172 int nPMCode, char ** ppszName, double *pdfOffset );
173 int GTIF_DLL GTIFGetPMInfo( int nPM, char **ppszName,
174 double * pdfLongToGreenwich );
175
176 double GTIF_DLL GTIFAngleStringToDD( const char *pszAngle, int nUOMAngle );
177
178 int GTIF_DLL GTIFGetUOMLengthInfoEx( void* ctx, /* The void* should be a PJ_CONTEXT* */
179 int nUOMLengthCode,
180 char **ppszUOMName,
181 double * pdfInMeters );
182 int GTIF_DLL GTIFGetUOMLengthInfo( int nUOMLengthCode,
183 char **ppszUOMName,
184 double * pdfInMeters );
185
186 int GTIF_DLL GTIFGetUOMAngleInfoEx( void* ctx, /* The void* should be a PJ_CONTEXT* */
187 int nUOMAngleCode,
188 char **ppszUOMName,
189 double * pdfInDegrees );
190 int GTIF_DLL GTIFGetUOMAngleInfo( int nUOMAngleCode,
191 char **ppszUOMName,
192 double * pdfInDegrees );
193 double GTIF_DLL GTIFAngleToDD( double dfAngle, int nUOMAngle );
194
195
196 /* this should be used to free strings returned by GTIFGet... funcs */
197 void GTIF_DLL GTIFFreeMemory( char * );
198
199 /* The void* should be a PJ_CONTEXT* */
200 void GTIF_DLL GTIFAttachPROJContext( GTIF *psGTIF, void* pjContext );
201 void GTIF_DLL *GTIFGetPROJContext( GTIF *psGTIF, int instantiateIfNeeded,
202 int* out_gtif_own_pj_context );
203
204 int GTIF_DLL GTIFGetDefn( GTIF *psGTIF, GTIFDefn * psDefn );
205 void GTIF_DLL GTIFPrintDefn( GTIFDefn *, FILE * );
206 void GTIF_DLL GTIFPrintDefnEx( GTIF *psGTIF, GTIFDefn *, FILE * );
207 GTIFDefn GTIF_DLL *GTIFAllocDefn( void );
208 void GTIF_DLL GTIFFreeDefn( GTIFDefn * );
209
210 const char GTIF_DLL *GTIFDecToDMS( double, const char *, int );
211
212 /*
213 * These are useful for recognising UTM and State Plane.
214 */
215
216 #define MapSys_UTM_North -9001
217 #define MapSys_UTM_South -9002
218 #define MapSys_State_Plane_27 -9003
219 #define MapSys_State_Plane_83 -9004
220
221 int GTIF_DLL GTIFMapSysToPCS( int MapSys, int Datum, int nZone );
222 int GTIF_DLL GTIFMapSysToProj( int MapSys, int nZone );
223 int GTIF_DLL GTIFPCSToMapSys( int PCSCode, int * pDatum, int * pZone );
224 int GTIF_DLL GTIFProjToMapSys( int ProjCode, int * pZone );
225
226 /*
227 * These are only useful if using libgeotiff with libproj (PROJ.4+).
228 */
229 char GTIF_DLL *GTIFGetProj4Defn( GTIFDefn * );
230
231 int GTIF_DLL GTIFProj4ToLatLong( GTIFDefn *, int, double *, double * );
232 int GTIF_DLL GTIFProj4FromLatLong( GTIFDefn *, int, double *, double * );
233
234 int GTIF_DLL GTIFSetFromProj4( GTIF *gtif, const char *proj4 );
235
236
237 /*
238 * The following functions were used up to libgeotiff 1.4.X series, but
239 * are now no-operation, since there is no longer any CSV use in libgeotiff.
240 */
241 void GTIF_DLL GTIFDeaccessCSV( void );
242
243
244 #ifdef __cplusplus
245 }
246 #endif
247
248 #endif /* ndef GEO_NORMALIZE_H_INCLUDED */