~ubuntu-branches/ubuntu/hardy/libterralib/hardy

« back to all changes in this revision

Viewing changes to src/tiff/geo_normalize.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2005-11-25 22:32:59 UTC
  • Revision ID: james.westby@ubuntu.com-20051125223259-3zubal8ux4ki4fjg
Tags: upstream-3.0.3b2
ImportĀ upstreamĀ versionĀ 3.0.3b2

Show diffs side-by-side

added added

removed removed

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