00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
#ifndef _OGR_SPATIALREF_H_INCLUDED
00082
#define _OGR_SPATIALREF_H_INCLUDED
00083
00084
#include "ogr_srs_api.h"
00085
00092
00093
00094
00095
00109 class CPL_DLL OGR_SRSNode
00110 {
00111
char *pszValue;
00112
00113
int nChildren;
00114 OGR_SRSNode **papoChildNodes;
00115
00116 OGR_SRSNode *poParent;
00117
00118
void ClearChildren();
00119
int NeedsQuoting()
const;
00120
00121
public:
00122 OGR_SRSNode(
const char * = NULL);
00123 ~OGR_SRSNode();
00124
00125
int IsLeafNode()
const {
return nChildren == 0; }
00126
00127 int GetChildCount()
const {
return nChildren; }
00128 OGR_SRSNode *GetChild(
int );
00129
const OGR_SRSNode *GetChild(
int ) const;
00130
00131 OGR_SRSNode *GetNode( const
char * );
00132 const OGR_SRSNode *GetNode( const
char * ) const;
00133
00134
void InsertChild( OGR_SRSNode *,
int );
00135
void AddChild( OGR_SRSNode * );
00136
int FindChild( const
char * ) const;
00137
void DestroyChild(
int );
00138
void StripNodes( const
char * );
00139
00140 const
char *GetValue()
const {
return pszValue; }
00141
void SetValue(
const char * );
00142
00143
void MakeValueSafe();
00144 OGRErr FixupOrdering();
00145
00146 OGR_SRSNode *Clone() const;
00147
00148 OGRErr importFromWkt(
char ** );
00149 OGRErr exportToWkt(
char ** ) const;
00150 OGRErr exportToPrettyWkt(
char **,
int = 1) const;
00151
00152 OGRErr applyRemapper( const
char *pszNode,
00153
char **papszSrcValues,
00154
char **papszDstValues,
00155
int nStepSize = 1,
00156
int bChildOfHit = FALSE );
00157 };
00158
00159
00160
00161
00162
00177 class CPL_DLL
OGRSpatialReference
00178 {
00179
int nRefCount;
00180
00181 OGR_SRSNode *poRoot;
00182
00183
int bNormInfoSet;
00184
double dfFromGreenwich;
00185
double dfToMeter;
00186
double dfToDegrees;
00187
00188 OGRErr ValidateProjection();
00189
int IsAliasFor(
const char *,
const char * );
00190
void GetNormInfo()
const;
00191
00192
public:
00193 OGRSpatialReference(
const OGRSpatialReference&);
00194 OGRSpatialReference(
const char * = NULL);
00195
00196
virtual ~OGRSpatialReference();
00197
00198 OGRSpatialReference &operator=(
const OGRSpatialReference&);
00199
00200
int Reference();
00201
int Dereference();
00202 int GetReferenceCount()
const {
return nRefCount; }
00203
00204 OGRSpatialReference *Clone() const;
00205 OGRSpatialReference *CloneGeogCS() const;
00206
00207 OGRErr exportToWkt(
char ** );
00208 OGRErr exportToPrettyWkt(
char **,
int = FALSE) const;
00209 OGRErr exportToProj4(
char ** ) const;
00210 OGRErr exportToPCI(
char **,
char **,
double ** ) const;
00211 OGRErr exportToUSGS(
long *,
long *,
double **,
long * ) const;
00212 OGRErr exportToXML(
char **, const
char * = NULL ) const;
00213 OGRErr importFromWkt(
char ** );
00214 OGRErr importFromProj4( const
char * );
00215 OGRErr importFromEPSG(
int );
00216 OGRErr importFromESRI(
char ** );
00217 OGRErr importFromPCI( const
char *pszProj,
00218 const
char *pszUnits = NULL,
00219
double *padfPrjParams = NULL );
00220 OGRErr importFromUSGS(
long iProjsys,
long iZone,
00221
double *padfPrjParams,
long iDatum );
00222 OGRErr importFromWMSAUTO( const
char *pszAutoDef );
00223 OGRErr importFromXML( const
char * );
00224 OGRErr importFromDict( const
char *pszDict, const
char *pszCode );
00225
00226 OGRErr morphToESRI();
00227 OGRErr morphFromESRI();
00228
00229 OGRErr Validate();
00230 OGRErr StripCTParms( OGR_SRSNode * = NULL );
00231 OGRErr FixupOrdering();
00232 OGRErr Fixup();
00233
00234
00235 OGR_SRSNode *GetRoot() {
return poRoot; }
00236
const OGR_SRSNode *GetRoot()
const {
return poRoot; }
00237
void SetRoot( OGR_SRSNode * );
00238
00239 OGR_SRSNode *GetAttrNode(
const char *);
00240
const OGR_SRSNode *GetAttrNode(
const char *) const;
00241 const
char *GetAttrValue(const
char *,
int = 0) const;
00242
00243 OGRErr SetNode( const
char *, const
char * );
00244 OGRErr SetNode( const
char *,
double );
00245
00246 OGRErr SetLinearUnits( const
char *pszName,
double dfInMeters );
00247
double GetLinearUnits(
char ** = NULL ) const;
00248
00249 OGRErr SetAngularUnits( const
char *pszName,
double dfInRadians );
00250
double GetAngularUnits(
char ** = NULL ) const;
00251
00252
double GetPrimeMeridian(
char ** = NULL ) const;
00253
00254
int IsGeographic() const;
00255
int IsProjected() const;
00256
int IsLocal() const;
00257
int IsSameGeogCS( const OGRSpatialReference * ) const;
00258
int IsSame( const OGRSpatialReference * ) const;
00259
00260
void Clear();
00261 OGRErr SetLocalCS( const
char * );
00262 OGRErr SetProjCS( const
char * );
00263 OGRErr SetProjection( const
char * );
00264 OGRErr SetGeogCS( const
char * pszGeogName,
00265 const
char * pszDatumName,
00266 const
char * pszEllipsoidName,
00267
double dfSemiMajor,
double dfInvFlattening,
00268 const
char * pszPMName = NULL,
00269
double dfPMOffset = 0.0,
00270 const
char * pszUnits = NULL,
00271
double dfConvertToRadians = 0.0 );
00272 OGRErr SetWellKnownGeogCS( const
char * );
00273 OGRErr CopyGeogCSFrom( const OGRSpatialReference * poSrcSRS );
00274
00275 OGRErr SetFromUserInput( const
char * );
00276
00277 OGRErr SetTOWGS84(
double,
double,
double,
00278
double = 0.0,
double = 0.0,
double = 0.0,
00279
double = 0.0 );
00280 OGRErr GetTOWGS84(
double *padfCoef,
int nCoeff = 7 ) const;
00281
00282
double GetSemiMajor( OGRErr * = NULL ) const;
00283
double GetSemiMinor( OGRErr * = NULL ) const;
00284
double GetInvFlattening( OGRErr * = NULL ) const;
00285
00286 OGRErr SetAuthority( const
char * pszTargetKey,
00287 const
char * pszAuthority,
00288
int nCode );
00289
00290 OGRErr AutoIdentifyEPSG();
00291
00292 const
char *GetAuthorityCode( const
char * pszTargetKey ) const;
00293 const
char *GetAuthorityName( const
char * pszTargetKey ) const;
00294
00295 OGRErr SetProjParm( const
char *,
double );
00296
double GetProjParm( const
char *,
double =0.0, OGRErr* = NULL ) const;
00297
00298 OGRErr SetNormProjParm( const
char *,
double );
00299
double GetNormProjParm( const
char *,
double=0.0, OGRErr* =NULL)const;
00300
00301 static
int IsAngularParameter( const
char * );
00302 static
int IsLongitudeParameter( const
char * );
00303 static
int IsLinearParameter( const
char * );
00304
00306 OGRErr SetACEA(
double dfStdP1,
double dfStdP2,
00307
double dfCenterLat,
double dfCenterLong,
00308
double dfFalseEasting,
double dfFalseNorthing );
00309
00311 OGRErr SetAE(
double dfCenterLat,
double dfCenterLong,
00312
double dfFalseEasting,
double dfFalseNorthing );
00313
00315 OGRErr SetCEA(
double dfStdP1,
double dfCentralMeridian,
00316
double dfFalseEasting,
double dfFalseNorthing );
00317
00319 OGRErr SetCS(
double dfCenterLat,
double dfCenterLong,
00320
double dfFalseEasting,
double dfFalseNorthing );
00321
00323 OGRErr SetEC(
double dfStdP1,
double dfStdP2,
00324
double dfCenterLat,
double dfCenterLong,
00325
double dfFalseEasting,
double dfFalseNorthing );
00326
00328 OGRErr SetEckertIV(
double dfCentralMeridian,
00329
double dfFalseEasting,
double dfFalseNorthing );
00330
00332 OGRErr SetEckertVI(
double dfCentralMeridian,
00333
double dfFalseEasting,
double dfFalseNorthing );
00334
00336 OGRErr SetEquirectangular(
double dfCenterLat,
double dfCenterLong,
00337
double dfFalseEasting,
double dfFalseNorthing );
00338
00340 OGRErr SetGS(
double dfCentralMeridian,
00341
double dfFalseEasting,
double dfFalseNorthing );
00342
00344 OGRErr SetGnomonic(
double dfCenterLat,
double dfCenterLong,
00345
double dfFalseEasting,
double dfFalseNorthing );
00346
00347 OGRErr SetHOM(
double dfCenterLat,
double dfCenterLong,
00348
double dfAzimuth,
double dfRectToSkew,
00349
double dfScale,
00350
double dfFalseEasting,
double dfFalseNorthing );
00351
00352 OGRErr SetHOM2PNO(
double dfCenterLat,
00353
double dfLat1,
double dfLong1,
00354
double dfLat2,
double dfLong2,
00355
double dfScale,
00356
double dfFalseEasting,
double dfFalseNorthing );
00357
00359 OGRErr SetKrovak(
double dfCenterLat,
double dfCenterLong,
00360
double dfAzimuth,
double dfPseudoStdParallelLat,
00361
double dfScale,
00362
double dfFalseEasting,
double dfFalseNorthing );
00363
00365 OGRErr SetLAEA(
double dfCenterLat,
double dfCenterLong,
00366
double dfFalseEasting,
double dfFalseNorthing );
00367
00369 OGRErr SetLCC(
double dfStdP1,
double dfStdP2,
00370
double dfCenterLat,
double dfCenterLong,
00371
double dfFalseEasting,
double dfFalseNorthing );
00372
00374 OGRErr SetLCC1SP(
double dfCenterLat,
double dfCenterLong,
00375
double dfScale,
00376
double dfFalseEasting,
double dfFalseNorthing );
00377
00379 OGRErr SetLCCB(
double dfStdP1,
double dfStdP2,
00380
double dfCenterLat,
double dfCenterLong,
00381
double dfFalseEasting,
double dfFalseNorthing );
00382
00384 OGRErr SetMC(
double dfCenterLat,
double dfCenterLong,
00385
double dfFalseEasting,
double dfFalseNorthing );
00386
00388 OGRErr SetMercator(
double dfCenterLat,
double dfCenterLong,
00389
double dfScale,
00390
double dfFalseEasting,
double dfFalseNorthing );
00391
00393 OGRErr SetMollweide(
double dfCentralMeridian,
00394
double dfFalseEasting,
double dfFalseNorthing );
00395
00397 OGRErr SetNZMG(
double dfCenterLat,
double dfCenterLong,
00398
double dfFalseEasting,
double dfFalseNorthing );
00399
00401 OGRErr SetOS(
double dfOriginLat,
double dfCMeridian,
00402
double dfScale,
00403
double dfFalseEasting,
double dfFalseNorthing);
00404
00406 OGRErr SetOrthographic(
double dfCenterLat,
double dfCenterLong,
00407
double dfFalseEasting,
double dfFalseNorthing);
00408
00410 OGRErr SetPolyconic(
double dfCenterLat,
double dfCenterLong,
00411
double dfFalseEasting,
double dfFalseNorthing );
00412
00414 OGRErr SetPS(
double dfCenterLat,
double dfCenterLong,
00415
double dfScale,
00416
double dfFalseEasting,
double dfFalseNorthing);
00417
00419 OGRErr SetRobinson(
double dfCenterLong,
00420
double dfFalseEasting,
double dfFalseNorthing );
00421
00423 OGRErr SetSinusoidal(
double dfCenterLong,
00424
double dfFalseEasting,
double dfFalseNorthing );
00425
00427 OGRErr SetStereographic(
double dfCenterLat,
double dfCenterLong,
00428
double dfScale,
00429
double dfFalseEasting,
double dfFalseNorthing);
00430
00432 OGRErr SetSOC(
double dfLatitudeOfOrigin,
double dfCentralMeridian,
00433
double dfFalseEasting,
double dfFalseNorthing );
00434
00436 OGRErr SetTM(
double dfCenterLat,
double dfCenterLong,
00437
double dfScale,
00438
double dfFalseEasting,
double dfFalseNorthing );
00439
00441 OGRErr SetTMVariant( const
char *pszVariantName,
00442
double dfCenterLat,
double dfCenterLong,
00443
double dfScale,
00444
double dfFalseEasting,
double dfFalseNorthing );
00445
00447 OGRErr SetTMG(
double dfCenterLat,
double dfCenterLong,
00448
double dfFalseEasting,
double dfFalseNorthing );
00449
00451 OGRErr SetTMSO(
double dfCenterLat,
double dfCenterLong,
00452
double dfScale,
00453
double dfFalseEasting,
double dfFalseNorthing );
00454
00456 OGRErr SetVDG(
double dfCenterLong,
00457
double dfFalseEasting,
double dfFalseNorthing );
00458
00460 OGRErr SetUTM(
int nZone,
int bNorth = TRUE );
00461
int GetUTMZone(
int *pbNorth = NULL ) const;
00462
00464 OGRErr SetStatePlane(
int nZone,
int bNAD83 = TRUE,
00465 const
char *pszOverrideUnitName = NULL,
00466
double dfOverrideUnit = 0.0 );
00467 };
00468
00469
00470
00471
00472
00473
00474
00475
00482 class CPL_DLL
OGRCoordinateTransformation
00483 {
00484
public:
00485
virtual ~OGRCoordinateTransformation() {}
00486
00487
00488
00490
virtual OGRSpatialReference *GetSourceCS() = 0;
00491
00493
virtual OGRSpatialReference *GetTargetCS() = 0;
00494
00495
00496
00512
virtual int Transform(
int nCount,
00513
double *x,
double *y,
double *z = NULL ) = 0;
00514
00530
virtual int TransformEx(
int nCount,
00531
double *x,
double *y,
double *z = NULL,
00532
int *pabSuccess = NULL ) = 0;
00533
00534 };
00535
00536
OGRCoordinateTransformation CPL_DLL *
00537
OGRCreateCoordinateTransformation( OGRSpatialReference *poSource,
00538 OGRSpatialReference *poTarget );
00539
00540
#endif