"Fossies" - the Fresh Open Source Software Archive

Member "libgeotiff-1.6.0/geo_normalize.h" (17 Jul 2019, 10204 Bytes) of package /linux/privat/libgeotiff-1.6.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "geo_normalize.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 1.5.1_vs_1.6.0.

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