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
#ifndef _OGR_SPATIALREF_H_INCLUDED
00079
#define _OGR_SPATIALREF_H_INCLUDED
00080
00081
#include "ogr_srs_api.h"
00082
00089
00090
00091
00092
00106 class CPL_DLL OGR_SRSNode
00107 {
00108
char *pszValue;
00109
00110
int nChildren;
00111 OGR_SRSNode **papoChildNodes;
00112
00113 OGR_SRSNode *poParent;
00114
00115
void ClearChildren();
00116
int NeedsQuoting()
const;
00117
00118
public:
00119 OGR_SRSNode(
const char * = NULL);
00120 ~OGR_SRSNode();
00121
00122
int IsLeafNode()
const {
return nChildren == 0; }
00123
00124 int GetChildCount()
const {
return nChildren; }
00125 OGR_SRSNode *GetChild(
int );
00126
const OGR_SRSNode *GetChild(
int ) const;
00127
00128 OGR_SRSNode *GetNode( const
char * );
00129 const OGR_SRSNode *GetNode( const
char * ) const;
00130
00131
void InsertChild( OGR_SRSNode *,
int );
00132
void AddChild( OGR_SRSNode * );
00133
int FindChild( const
char * ) const;
00134
void DestroyChild(
int );
00135
void StripNodes( const
char * );
00136
00137 const
char *GetValue()
const {
return pszValue; }
00138
void SetValue(
const char * );
00139
00140
void MakeValueSafe();
00141 OGRErr FixupOrdering();
00142
00143 OGR_SRSNode *Clone() const;
00144
00145 OGRErr importFromWkt(
char ** );
00146 OGRErr exportToWkt(
char ** ) const;
00147 OGRErr exportToPrettyWkt(
char **,
int = 1) const;
00148
00149 OGRErr applyRemapper( const
char *pszNode,
00150
char **papszSrcValues,
00151
char **papszDstValues,
00152
int nStepSize = 1,
00153
int bChildOfHit = FALSE );
00154 };
00155
00156
00157
00158
00159
00174 class CPL_DLL
OGRSpatialReference
00175 {
00176
int nRefCount;
00177
00178 OGR_SRSNode *poRoot;
00179
00180
int bNormInfoSet;
00181
double dfFromGreenwich;
00182
double dfToMeter;
00183
double dfToDegrees;
00184
00185 OGRErr ValidateProjection();
00186
int IsAliasFor(
const char *,
const char * );
00187
void GetNormInfo()
const;
00188
00189
public:
00190 OGRSpatialReference(
const OGRSpatialReference&);
00191 OGRSpatialReference(
const char * = NULL);
00192
00193
virtual ~OGRSpatialReference();
00194
00195 OGRSpatialReference &operator=(
const OGRSpatialReference&);
00196
00197
int Reference();
00198
int Dereference();
00199 int GetReferenceCount()
const {
return nRefCount; }
00200
00201 OGRSpatialReference *Clone() const;
00202 OGRSpatialReference *CloneGeogCS() const;
00203
00204 OGRErr exportToWkt(
char ** );
00205 OGRErr exportToPrettyWkt(
char **,
int = FALSE) const;
00206 OGRErr exportToProj4(
char ** ) const;
00207 OGRErr exportToPCI(
char **,
char **,
double ** ) const;
00208 OGRErr exportToUSGS(
long *,
long *,
double **,
long * ) const;
00209 OGRErr exportToXML(
char **, const
char * = NULL ) const;
00210 OGRErr importFromWkt(
char ** );
00211 OGRErr importFromProj4( const
char * );
00212 OGRErr importFromEPSG(
int );
00213 OGRErr importFromESRI(
char ** );
00214 OGRErr importFromPCI( const
char *pszProj,
00215 const
char *pszUnits = NULL,
00216
double *padfPrjParams = NULL );
00217 OGRErr importFromUSGS(
long iProjsys,
long iZone,
00218
double *padfPrjParams,
long iDatum );
00219 OGRErr importFromWMSAUTO( const
char *pszAutoDef );
00220 OGRErr importFromXML( const
char * );
00221 OGRErr importFromDict( const
char *pszDict, const
char *pszCode );
00222
00223 OGRErr morphToESRI();
00224 OGRErr morphFromESRI();
00225
00226 OGRErr Validate();
00227 OGRErr StripCTParms( OGR_SRSNode * = NULL );
00228 OGRErr FixupOrdering();
00229 OGRErr Fixup();
00230
00231
00232 OGR_SRSNode *GetRoot() {
return poRoot; }
00233
const OGR_SRSNode *GetRoot()
const {
return poRoot; }
00234
void SetRoot( OGR_SRSNode * );
00235
00236 OGR_SRSNode *GetAttrNode(
const char *);
00237
const OGR_SRSNode *GetAttrNode(
const char *) const;
00238 const
char *GetAttrValue(const
char *,
int = 0) const;
00239
00240 OGRErr SetNode( const
char *, const
char * );
00241 OGRErr SetNode( const
char *,
double );
00242
00243 OGRErr SetLinearUnits( const
char *pszName,
double dfInMeters );
00244
double GetLinearUnits(
char ** = NULL ) const;
00245
00246 OGRErr SetAngularUnits( const
char *pszName,
double dfInRadians );
00247
double GetAngularUnits(
char ** = NULL ) const;
00248
00249
double GetPrimeMeridian(
char ** = NULL ) const;
00250
00251
int IsGeographic() const;
00252
int IsProjected() const;
00253
int IsLocal() const;
00254
int IsSameGeogCS( const OGRSpatialReference * ) const;
00255
int IsSame( const OGRSpatialReference * ) const;
00256
00257
void Clear();
00258 OGRErr SetLocalCS( const
char * );
00259 OGRErr SetProjCS( const
char * );
00260 OGRErr SetProjection( const
char * );
00261 OGRErr SetGeogCS( const
char * pszGeogName,
00262 const
char * pszDatumName,
00263 const
char * pszEllipsoidName,
00264
double dfSemiMajor,
double dfInvFlattening,
00265 const
char * pszPMName = NULL,
00266
double dfPMOffset = 0.0,
00267 const
char * pszUnits = NULL,
00268
double dfConvertToRadians = 0.0 );
00269 OGRErr SetWellKnownGeogCS( const
char * );
00270 OGRErr CopyGeogCSFrom( const OGRSpatialReference * poSrcSRS );
00271
00272 OGRErr SetFromUserInput( const
char * );
00273
00274 OGRErr SetTOWGS84(
double,
double,
double,
00275
double = 0.0,
double = 0.0,
double = 0.0,
00276
double = 0.0 );
00277 OGRErr GetTOWGS84(
double *padfCoef,
int nCoeff = 7 ) const;
00278
00279
double GetSemiMajor( OGRErr * = NULL ) const;
00280
double GetSemiMinor( OGRErr * = NULL ) const;
00281
double GetInvFlattening( OGRErr * = NULL ) const;
00282
00283 OGRErr SetAuthority( const
char * pszTargetKey,
00284 const
char * pszAuthority,
00285
int nCode );
00286
00287 const
char *GetAuthorityCode( const
char * pszTargetKey ) const;
00288 const
char *GetAuthorityName( const
char * pszTargetKey ) const;
00289
00290 OGRErr SetProjParm( const
char *,
double );
00291
double GetProjParm( const
char *,
double =0.0, OGRErr* = NULL ) const;
00292
00293 OGRErr SetNormProjParm( const
char *,
double );
00294
double GetNormProjParm( const
char *,
double=0.0, OGRErr* =NULL)const;
00295
00296 static
int IsAngularParameter( const
char * );
00297 static
int IsLongitudeParameter( const
char * );
00298 static
int IsLinearParameter( const
char * );
00299
00301 OGRErr SetACEA(
double dfStdP1,
double dfStdP2,
00302
double dfCenterLat,
double dfCenterLong,
00303
double dfFalseEasting,
double dfFalseNorthing );
00304
00306 OGRErr SetAE(
double dfCenterLat,
double dfCenterLong,
00307
double dfFalseEasting,
double dfFalseNorthing );
00308
00310 OGRErr SetCEA(
double dfStdP1,
double dfCentralMeridian,
00311
double dfFalseEasting,
double dfFalseNorthing );
00312
00314 OGRErr SetCS(
double dfCenterLat,
double dfCenterLong,
00315
double dfFalseEasting,
double dfFalseNorthing );
00316
00318 OGRErr SetEC(
double dfStdP1,
double dfStdP2,
00319
double dfCenterLat,
double dfCenterLong,
00320
double dfFalseEasting,
double dfFalseNorthing );
00321
00323 OGRErr SetEckertIV(
double dfCentralMeridian,
00324
double dfFalseEasting,
double dfFalseNorthing );
00325
00327 OGRErr SetEckertVI(
double dfCentralMeridian,
00328
double dfFalseEasting,
double dfFalseNorthing );
00329
00331 OGRErr SetEquirectangular(
double dfCenterLat,
double dfCenterLong,
00332
double dfFalseEasting,
double dfFalseNorthing );
00333
00335 OGRErr SetGS(
double dfCentralMeridian,
00336
double dfFalseEasting,
double dfFalseNorthing );
00337
00339 OGRErr SetGnomonic(
double dfCenterLat,
double dfCenterLong,
00340
double dfFalseEasting,
double dfFalseNorthing );
00341
00342 OGRErr SetHOM(
double dfCenterLat,
double dfCenterLong,
00343
double dfAzimuth,
double dfRectToSkew,
00344
double dfScale,
00345
double dfFalseEasting,
double dfFalseNorthing );
00346
00347 OGRErr SetHOM2PNO(
double dfCenterLat,
00348
double dfLat1,
double dfLong1,
00349
double dfLat2,
double dfLong2,
00350
double dfScale,
00351
double dfFalseEasting,
double dfFalseNorthing );
00352
00354 OGRErr SetKrovak(
double dfCenterLat,
double dfCenterLong,
00355
double dfAzimuth,
double dfPseudoStdParallelLat,
00356
double dfScale,
00357
double dfFalseEasting,
double dfFalseNorthing );
00358
00360 OGRErr SetLAEA(
double dfCenterLat,
double dfCenterLong,
00361
double dfFalseEasting,
double dfFalseNorthing );
00362
00364 OGRErr SetLCC(
double dfStdP1,
double dfStdP2,
00365
double dfCenterLat,
double dfCenterLong,
00366
double dfFalseEasting,
double dfFalseNorthing );
00367
00369 OGRErr SetLCC1SP(
double dfCenterLat,
double dfCenterLong,
00370
double dfScale,
00371
double dfFalseEasting,
double dfFalseNorthing );
00372
00374 OGRErr SetLCCB(
double dfStdP1,
double dfStdP2,
00375
double dfCenterLat,
double dfCenterLong,
00376
double dfFalseEasting,
double dfFalseNorthing );
00377
00379 OGRErr SetMC(
double dfCenterLat,
double dfCenterLong,
00380
double dfFalseEasting,
double dfFalseNorthing );
00381
00383 OGRErr SetMercator(
double dfCenterLat,
double dfCenterLong,
00384
double dfScale,
00385
double dfFalseEasting,
double dfFalseNorthing );
00386
00388 OGRErr SetMollweide(
double dfCentralMeridian,
00389
double dfFalseEasting,
double dfFalseNorthing );
00390
00392 OGRErr SetNZMG(
double dfCenterLat,
double dfCenterLong,
00393
double dfFalseEasting,
double dfFalseNorthing );
00394
00396 OGRErr SetOS(
double dfOriginLat,
double dfCMeridian,
00397
double dfScale,
00398
double dfFalseEasting,
double dfFalseNorthing);
00399
00401 OGRErr SetOrthographic(
double dfCenterLat,
double dfCenterLong,
00402
double dfFalseEasting,
double dfFalseNorthing);
00403
00405 OGRErr SetPolyconic(
double dfCenterLat,
double dfCenterLong,
00406
double dfFalseEasting,
double dfFalseNorthing );
00407
00409 OGRErr SetPS(
double dfCenterLat,
double dfCenterLong,
00410
double dfScale,
00411
double dfFalseEasting,
double dfFalseNorthing);
00412
00414 OGRErr SetRobinson(
double dfCenterLong,
00415
double dfFalseEasting,
double dfFalseNorthing );
00416
00418 OGRErr SetSinusoidal(
double dfCenterLong,
00419
double dfFalseEasting,
double dfFalseNorthing );
00420
00422 OGRErr SetStereographic(
double dfCenterLat,
double dfCenterLong,
00423
double dfScale,
00424
double dfFalseEasting,
double dfFalseNorthing);
00425
00427 OGRErr SetSOC(
double dfLatitudeOfOrigin,
double dfCentralMeridian,
00428
double dfFalseEasting,
double dfFalseNorthing );
00429
00431 OGRErr SetTM(
double dfCenterLat,
double dfCenterLong,
00432
double dfScale,
00433
double dfFalseEasting,
double dfFalseNorthing );
00434
00436 OGRErr SetTMVariant( const
char *pszVariantName,
00437
double dfCenterLat,
double dfCenterLong,
00438
double dfScale,
00439
double dfFalseEasting,
double dfFalseNorthing );
00440
00442 OGRErr SetTMG(
double dfCenterLat,
double dfCenterLong,
00443
double dfFalseEasting,
double dfFalseNorthing );
00444
00446 OGRErr SetTMSO(
double dfCenterLat,
double dfCenterLong,
00447
double dfScale,
00448
double dfFalseEasting,
double dfFalseNorthing );
00449
00451 OGRErr SetVDG(
double dfCenterLong,
00452
double dfFalseEasting,
double dfFalseNorthing );
00453
00455 OGRErr SetUTM(
int nZone,
int bNorth = TRUE );
00456
int GetUTMZone(
int *pbNorth = NULL ) const;
00457
00459 OGRErr SetStatePlane(
int nZone,
int bNAD83 = TRUE,
00460 const
char *pszOverrideUnitName = NULL,
00461
double dfOverrideUnit = 0.0 );
00462 };
00463
00464
00465
00466
00467
00468
00469
00470
00477 class CPL_DLL
OGRCoordinateTransformation
00478 {
00479
public:
00480
virtual ~OGRCoordinateTransformation() {}
00481
00482
00483
00485
virtual OGRSpatialReference *GetSourceCS() = 0;
00486
00488
virtual OGRSpatialReference *GetTargetCS() = 0;
00489
00490
00491
00507
virtual int Transform(
int nCount,
00508
double *x,
double *y,
double *z = NULL ) = 0;
00509
00525
virtual int TransformEx(
int nCount,
00526
double *x,
double *y,
double *z = NULL,
00527
int *pabSuccess = NULL ) = 0;
00528
00529 };
00530
00531
OGRCoordinateTransformation CPL_DLL *
00532
OGRCreateCoordinateTransformation( OGRSpatialReference *poSource,
00533 OGRSpatialReference *poTarget );
00534
00535
#endif