GDAL
ogr_spatialref.h
Go to the documentation of this file.
1 /******************************************************************************
2  * $Id: ogr_spatialref.h 111ddab546748482d008cd057ff8ccfe5171a236 2020-04-23 21:09:58 +0200 Even Rouault $
3  *
4  * Project: OpenGIS Simple Features Reference Implementation
5  * Purpose: Classes for manipulating spatial reference systems in a
6  * platform non-specific manner.
7  * Author: Frank Warmerdam, warmerdam@pobox.com
8  *
9  ******************************************************************************
10  * Copyright (c) 1999, Les Technologies SoftMap Inc.
11  * Copyright (c) 2008-2013, Even Rouault <even dot rouault at spatialys.com>
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the "Software"),
15  * to deal in the Software without restriction, including without limitation
16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  * and/or sell copies of the Software, and to permit persons to whom the
18  * Software is furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included
21  * in all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29  * DEALINGS IN THE SOFTWARE.
30  ****************************************************************************/
31 
32 #ifndef OGR_SPATIALREF_H_INCLUDED
33 #define OGR_SPATIALREF_H_INCLUDED
34 
35 #include "cpl_string.h"
36 #include "ogr_srs_api.h"
37 
38 #include <cstddef>
39 #include <map>
40 #include <memory>
41 #include <vector>
42 
49 /************************************************************************/
50 /* OGR_SRSNode */
51 /************************************************************************/
52 
66 class CPL_DLL OGR_SRSNode
67 {
68  public:
70  struct Listener
71  {
72  virtual ~Listener();
74  virtual void notifyChange(OGR_SRSNode*) = 0;
75  };
76 
77  explicit OGR_SRSNode(const char * = nullptr);
78  ~OGR_SRSNode();
79 
81  void RegisterListener(const std::shared_ptr<Listener>& listener);
82 
86  int IsLeafNode() const { return nChildren == 0; }
87 
88  int GetChildCount() const { return nChildren; }
89  OGR_SRSNode *GetChild( int );
90  const OGR_SRSNode *GetChild( int ) const;
91 
92  OGR_SRSNode *GetNode( const char * );
93  const OGR_SRSNode *GetNode( const char * ) const;
94 
95  void InsertChild( OGR_SRSNode *, int );
96  void AddChild( OGR_SRSNode * );
97  int FindChild( const char * ) const;
98  void DestroyChild( int );
99  void ClearChildren();
100  void StripNodes( const char * );
101 
102  const char *GetValue() const { return pszValue; }
103  void SetValue( const char * );
104 
105  void MakeValueSafe();
106 
107  OGR_SRSNode *Clone() const;
108 
109  OGRErr importFromWkt( char ** )
111  CPL_WARN_DEPRECATED("Use importFromWkt(const char**)")
113  ;
114  OGRErr importFromWkt( const char ** );
115  OGRErr exportToWkt( char ** ) const;
116  OGRErr exportToPrettyWkt( char **, int = 1) const;
117 
118  private:
119  char *pszValue;
120 
121  OGR_SRSNode **papoChildNodes;
122  OGR_SRSNode *poParent;
123 
124  int nChildren;
125 
126  int NeedsQuoting() const;
127  OGRErr importFromWkt( const char **, int nRecLevel, int* pnNodes );
128 
129  std::weak_ptr<Listener> m_listener{};
130  void notifyChange();
131 
133 };
134 
135 /************************************************************************/
136 /* OGRSpatialReference */
137 /************************************************************************/
138 
157 class CPL_DLL OGRSpatialReference
158 {
159  struct Private;
160  std::unique_ptr<Private> d;
161 
162  void GetNormInfo() const;
163 
164  OGRErr importFromURNPart(const char* pszAuthority,
165  const char* pszCode,
166  const char* pszURN);
167 
168  static CPLString lookupInDict( const char *pszDictFile,
169  const char *pszCode );
170 
171  public:
173  explicit OGRSpatialReference(const char * = nullptr);
174 
175  virtual ~OGRSpatialReference();
176 
177  static void DestroySpatialReference(OGRSpatialReference* poSRS);
178 
179  OGRSpatialReference &operator=(const OGRSpatialReference&);
180 
181  int Reference();
182  int Dereference();
183  int GetReferenceCount() const;
184  void Release();
185 
186  const char* GetName() const;
187 
188  OGRSpatialReference *Clone() const;
189  OGRSpatialReference *CloneGeogCS() const;
190 
191  void dumpReadable();
192  OGRErr exportToWkt( char ** ) const;
193  OGRErr exportToWkt( char ** ppszWKT, const char* const* papszOptions ) const;
194  OGRErr exportToPrettyWkt( char **, int = FALSE) const;
195  // cppcheck-suppress functionStatic
196  OGRErr exportToPROJJSON( char **, const char* const* papszOptions ) const;
197  OGRErr exportToProj4( char ** ) const;
198  OGRErr exportToPCI( char **, char **, double ** ) const;
199  OGRErr exportToUSGS( long *, long *, double **, long * ) const;
200  OGRErr exportToXML( char **, const char * = nullptr ) const;
201  OGRErr exportToPanorama( long *, long *, long *, long *,
202  double * ) const;
203  OGRErr exportToERM( char *pszProj, char *pszDatum, char *pszUnits );
204  OGRErr exportToMICoordSys( char ** ) const;
205 
206 
207  OGRErr importFromWkt( char ** )
209  CPL_WARN_DEPRECATED("Use importFromWkt(const char**) or importFromWkt(const char*)")
211  ;
212 
213  OGRErr importFromWkt( const char ** );
214  OGRErr importFromWkt( const char* );
215  OGRErr importFromProj4( const char * );
216  OGRErr importFromEPSG( int );
217  OGRErr importFromEPSGA( int );
218  OGRErr importFromESRI( char ** );
219  OGRErr importFromPCI( const char *, const char * = nullptr,
220  double * = nullptr );
221 
222 #define USGS_ANGLE_DECIMALDEGREES 0
223 #define USGS_ANGLE_PACKEDDMS TRUE
224 #define USGS_ANGLE_RADIANS 2
225  OGRErr importFromUSGS( long iProjSys, long iZone,
226  double *padfPrjParams, long iDatum,
227  int nUSGSAngleFormat = USGS_ANGLE_PACKEDDMS );
228  OGRErr importFromPanorama( long, long, long, double* );
229  OGRErr importVertCSFromPanorama( int );
230  OGRErr importFromOzi( const char * const* papszLines );
231  OGRErr importFromWMSAUTO( const char *pszAutoDef );
232  OGRErr importFromXML( const char * );
233  OGRErr importFromDict( const char *pszDict, const char *pszCode );
234  OGRErr importFromURN( const char * );
235  OGRErr importFromCRSURL( const char * );
236  OGRErr importFromERM( const char *pszProj, const char *pszDatum,
237  const char *pszUnits );
238  OGRErr importFromUrl( const char * );
239  OGRErr importFromMICoordSys( const char * );
240 
241  OGRErr morphToESRI();
242  OGRErr morphFromESRI();
243 
244  OGRSpatialReference* convertToOtherProjection(
245  const char* pszTargetProjection,
246  const char* const* papszOptions = nullptr ) const;
247 
248  OGRErr Validate() const;
249  OGRErr StripVertical();
250 
251  bool StripTOWGS84IfKnownDatumAndAllowed();
252  bool StripTOWGS84IfKnownDatum();
253 
254  int EPSGTreatsAsLatLong() const;
255  int EPSGTreatsAsNorthingEasting() const;
256  int GetAxesCount() const;
257  const char *GetAxis( const char *pszTargetKey, int iAxis,
258  OGRAxisOrientation *peOrientation ) const;
259  OGRErr SetAxes( const char *pszTargetKey,
260  const char *pszXAxisName,
261  OGRAxisOrientation eXAxisOrientation,
262  const char *pszYAxisName,
263  OGRAxisOrientation eYAxisOrientation );
264 
265  OSRAxisMappingStrategy GetAxisMappingStrategy() const;
266  void SetAxisMappingStrategy(OSRAxisMappingStrategy);
267  const std::vector<int>& GetDataAxisToSRSAxisMapping() const;
268  OGRErr SetDataAxisToSRSAxisMapping(const std::vector<int>& mapping);
269 
270  // Machinery for accessing parse nodes
271 
273  OGR_SRSNode *GetRoot();
275  const OGR_SRSNode *GetRoot() const;
276  void SetRoot( OGR_SRSNode * );
277 
278  OGR_SRSNode *GetAttrNode(const char *);
279  const OGR_SRSNode *GetAttrNode(const char *) const;
280  const char *GetAttrValue(const char *, int = 0) const;
281 
282  OGRErr SetNode( const char *, const char * );
283  OGRErr SetNode( const char *, double );
284 
285  OGRErr SetLinearUnitsAndUpdateParameters( const char *pszName,
286  double dfInMeters,
287  const char *pszUnitAuthority = nullptr,
288  const char *pszUnitCode = nullptr );
289  OGRErr SetLinearUnits( const char *pszName, double dfInMeters );
290  OGRErr SetTargetLinearUnits( const char *pszTargetKey,
291  const char *pszName,
292  double dfInMeters,
293  const char *pszUnitAuthority = nullptr,
294  const char *pszUnitCode = nullptr);
295 
296  double GetLinearUnits( char ** ) const CPL_WARN_DEPRECATED("Use GetLinearUnits(const char**) instead");
297  double GetLinearUnits( const char ** = nullptr ) const;
299  double GetLinearUnits( std::nullptr_t ) const
300  { return GetLinearUnits( static_cast<const char**>(nullptr) ); }
303  double GetTargetLinearUnits( const char *pszTargetKey,
304  char ** ppszRetName ) const
305  CPL_WARN_DEPRECATED("Use GetTargetLinearUnits(const char*, const char**)");
306  double GetTargetLinearUnits( const char *pszTargetKey,
307  const char ** ppszRetName = nullptr ) const;
309  double GetTargetLinearUnits( const char *pszTargetKey, std::nullptr_t ) const
310  { return GetTargetLinearUnits( pszTargetKey, static_cast<const char**>(nullptr) ); }
313  OGRErr SetAngularUnits( const char *pszName, double dfInRadians );
314  double GetAngularUnits( char ** ) const CPL_WARN_DEPRECATED("Use GetAngularUnits(const char**) instead");
315  double GetAngularUnits( const char ** = nullptr ) const;
317  double GetAngularUnits( std::nullptr_t ) const
318  { return GetAngularUnits( static_cast<const char**>(nullptr) ); }
321  double GetPrimeMeridian( char ** ) const CPL_WARN_DEPRECATED("Use GetPrimeMeridian(const char**) instead");
322  double GetPrimeMeridian( const char ** = nullptr ) const;
324  double GetPrimeMeridian( std::nullptr_t ) const
325  { return GetPrimeMeridian( static_cast<const char**>(nullptr) ); }
328  bool IsEmpty() const;
329  int IsGeographic() const;
330  int IsDerivedGeographic() const;
331  int IsProjected() const;
332  int IsGeocentric() const;
333  int IsLocal() const;
334  int IsVertical() const;
335  int IsCompound() const;
336  int IsSameGeogCS( const OGRSpatialReference * ) const;
337  int IsSameGeogCS( const OGRSpatialReference *,
338  const char* const * papszOptions ) const;
339  int IsSameVertCS( const OGRSpatialReference * ) const;
340  int IsSame( const OGRSpatialReference * ) const;
341  int IsSame( const OGRSpatialReference *,
342  const char* const * papszOptions ) const;
343 
344  void Clear();
345  OGRErr SetLocalCS( const char * );
346  OGRErr SetProjCS( const char * );
347  OGRErr SetProjection( const char * );
348  OGRErr SetGeocCS( const char * pszGeocName );
349  OGRErr SetGeogCS( const char * pszGeogName,
350  const char * pszDatumName,
351  const char * pszEllipsoidName,
352  double dfSemiMajor, double dfInvFlattening,
353  const char * pszPMName = nullptr,
354  double dfPMOffset = 0.0,
355  const char * pszUnits = nullptr,
356  double dfConvertToRadians = 0.0 );
357  OGRErr SetWellKnownGeogCS( const char * );
358  OGRErr CopyGeogCSFrom( const OGRSpatialReference * poSrcSRS );
359  OGRErr SetVertCS( const char *pszVertCSName,
360  const char *pszVertDatumName,
361  int nVertDatumClass = 2005 );
362  OGRErr SetCompoundCS( const char *pszName,
363  const OGRSpatialReference *poHorizSRS,
364  const OGRSpatialReference *poVertSRS );
365 
366  // cppcheck-suppress functionStatic
367  OGRErr PromoteTo3D( const char* pszName );
368 
369  OGRErr SetFromUserInput( const char * );
370 
371  OGRErr SetTOWGS84( double, double, double,
372  double = 0.0, double = 0.0, double = 0.0,
373  double = 0.0 );
374  OGRErr GetTOWGS84( double *padfCoef, int nCoeff = 7 ) const;
375  OGRErr AddGuessedTOWGS84();
376 
377  double GetSemiMajor( OGRErr * = nullptr ) const;
378  double GetSemiMinor( OGRErr * = nullptr ) const;
379  double GetInvFlattening( OGRErr * = nullptr ) const;
380  double GetEccentricity() const;
381  double GetSquaredEccentricity() const;
382 
383  OGRErr SetAuthority( const char * pszTargetKey,
384  const char * pszAuthority,
385  int nCode );
386 
387  OGRErr AutoIdentifyEPSG();
388  OGRSpatialReferenceH* FindMatches( char** papszOptions,
389  int* pnEntries,
390  int** ppanMatchConfidence ) const;
391 
392  int GetEPSGGeogCS() const;
393 
394  const char *GetAuthorityCode( const char * pszTargetKey ) const;
395  const char *GetAuthorityName( const char * pszTargetKey ) const;
396 
397  bool GetAreaOfUse( double* pdfWestLongitudeDeg,
398  double* pdfSouthLatitudeDeg,
399  double* pdfEastLongitudeDeg,
400  double* pdfNorthLatitudeDeg,
401  const char **ppszAreaName ) const;
402 
403  const char *GetExtension( const char *pszTargetKey,
404  const char *pszName,
405  const char *pszDefault = nullptr ) const;
406  OGRErr SetExtension( const char *pszTargetKey,
407  const char *pszName,
408  const char *pszValue );
409 
410  int FindProjParm( const char *pszParameter,
411  const OGR_SRSNode *poPROJCS=nullptr ) const;
412  OGRErr SetProjParm( const char *, double );
413  double GetProjParm( const char *, double =0.0, OGRErr* = nullptr ) const;
414 
415  OGRErr SetNormProjParm( const char *, double );
416  double GetNormProjParm( const char *, double=0.0, OGRErr* =nullptr)const;
417 
418  static int IsAngularParameter( const char * );
419  static int IsLongitudeParameter( const char * );
420  static int IsLinearParameter( const char * );
421 
423  OGRErr SetACEA( double dfStdP1, double dfStdP2,
424  double dfCenterLat, double dfCenterLong,
425  double dfFalseEasting, double dfFalseNorthing );
426 
428  OGRErr SetAE( double dfCenterLat, double dfCenterLong,
429  double dfFalseEasting, double dfFalseNorthing );
430 
432  OGRErr SetBonne( double dfStdP1, double dfCentralMeridian,
433  double dfFalseEasting, double dfFalseNorthing );
434 
436  OGRErr SetCEA( double dfStdP1, double dfCentralMeridian,
437  double dfFalseEasting, double dfFalseNorthing );
438 
440  OGRErr SetCS( double dfCenterLat, double dfCenterLong,
441  double dfFalseEasting, double dfFalseNorthing );
442 
444  OGRErr SetEC( double dfStdP1, double dfStdP2,
445  double dfCenterLat, double dfCenterLong,
446  double dfFalseEasting, double dfFalseNorthing );
447 
449  OGRErr SetEckert( int nVariation, double dfCentralMeridian,
450  double dfFalseEasting, double dfFalseNorthing );
451 
453  OGRErr SetEckertIV( double dfCentralMeridian,
454  double dfFalseEasting, double dfFalseNorthing );
455 
457  OGRErr SetEckertVI( double dfCentralMeridian,
458  double dfFalseEasting, double dfFalseNorthing );
459 
461  OGRErr SetEquirectangular(double dfCenterLat, double dfCenterLong,
462  double dfFalseEasting, double dfFalseNorthing );
464  OGRErr SetEquirectangular2( double dfCenterLat, double dfCenterLong,
465  double dfPseudoStdParallel1,
466  double dfFalseEasting, double dfFalseNorthing );
467 
469  OGRErr SetGEOS( double dfCentralMeridian, double dfSatelliteHeight,
470  double dfFalseEasting, double dfFalseNorthing );
471 
473  OGRErr SetGH( double dfCentralMeridian,
474  double dfFalseEasting, double dfFalseNorthing );
475 
477  OGRErr SetIGH();
478 
480  OGRErr SetGS( double dfCentralMeridian,
481  double dfFalseEasting, double dfFalseNorthing );
482 
484  OGRErr SetGaussSchreiberTMercator(double dfCenterLat, double dfCenterLong,
485  double dfScale,
486  double dfFalseEasting, double dfFalseNorthing );
487 
489  OGRErr SetGnomonic(double dfCenterLat, double dfCenterLong,
490  double dfFalseEasting, double dfFalseNorthing );
491 
493  OGRErr SetHOM( double dfCenterLat, double dfCenterLong,
494  double dfAzimuth, double dfRectToSkew,
495  double dfScale,
496  double dfFalseEasting, double dfFalseNorthing );
497 
499  OGRErr SetHOM2PNO( double dfCenterLat,
500  double dfLat1, double dfLong1,
501  double dfLat2, double dfLong2,
502  double dfScale,
503  double dfFalseEasting, double dfFalseNorthing );
504 
506  OGRErr SetHOMAC( double dfCenterLat, double dfCenterLong,
507  double dfAzimuth, double dfRectToSkew,
508  double dfScale,
509  double dfFalseEasting, double dfFalseNorthing );
510 
512  OGRErr SetLOM( double dfCenterLat, double dfCenterLong,
513  double dfAzimuth,
514  double dfScale,
515  double dfFalseEasting, double dfFalseNorthing );
516 
518  OGRErr SetIWMPolyconic( double dfLat1, double dfLat2,
519  double dfCenterLong,
520  double dfFalseEasting,
521  double dfFalseNorthing );
522 
524  OGRErr SetKrovak( double dfCenterLat, double dfCenterLong,
525  double dfAzimuth, double dfPseudoStdParallelLat,
526  double dfScale,
527  double dfFalseEasting, double dfFalseNorthing );
528 
530  OGRErr SetLAEA( double dfCenterLat, double dfCenterLong,
531  double dfFalseEasting, double dfFalseNorthing );
532 
534  OGRErr SetLCC( double dfStdP1, double dfStdP2,
535  double dfCenterLat, double dfCenterLong,
536  double dfFalseEasting, double dfFalseNorthing );
537 
539  OGRErr SetLCC1SP( double dfCenterLat, double dfCenterLong,
540  double dfScale,
541  double dfFalseEasting, double dfFalseNorthing );
542 
544  OGRErr SetLCCB( double dfStdP1, double dfStdP2,
545  double dfCenterLat, double dfCenterLong,
546  double dfFalseEasting, double dfFalseNorthing );
547 
549  OGRErr SetMC( double dfCenterLat, double dfCenterLong,
550  double dfFalseEasting, double dfFalseNorthing );
551 
553  OGRErr SetMercator( double dfCenterLat, double dfCenterLong,
554  double dfScale,
555  double dfFalseEasting, double dfFalseNorthing );
556 
558  OGRErr SetMercator2SP( double dfStdP1,
559  double dfCenterLat, double dfCenterLong,
560  double dfFalseEasting, double dfFalseNorthing );
561 
563  OGRErr SetMollweide( double dfCentralMeridian,
564  double dfFalseEasting, double dfFalseNorthing );
565 
567  OGRErr SetNZMG( double dfCenterLat, double dfCenterLong,
568  double dfFalseEasting, double dfFalseNorthing );
569 
571  OGRErr SetOS( double dfOriginLat, double dfCMeridian,
572  double dfScale,
573  double dfFalseEasting,double dfFalseNorthing);
574 
576  OGRErr SetOrthographic( double dfCenterLat, double dfCenterLong,
577  double dfFalseEasting,double dfFalseNorthing);
578 
580  OGRErr SetPolyconic( double dfCenterLat, double dfCenterLong,
581  double dfFalseEasting, double dfFalseNorthing );
582 
584  OGRErr SetPS( double dfCenterLat, double dfCenterLong,
585  double dfScale,
586  double dfFalseEasting, double dfFalseNorthing);
587 
589  OGRErr SetRobinson( double dfCenterLong,
590  double dfFalseEasting, double dfFalseNorthing );
591 
593  OGRErr SetSinusoidal( double dfCenterLong,
594  double dfFalseEasting, double dfFalseNorthing );
595 
597  OGRErr SetStereographic( double dfCenterLat, double dfCenterLong,
598  double dfScale,
599  double dfFalseEasting,double dfFalseNorthing);
600 
602  OGRErr SetSOC( double dfLatitudeOfOrigin, double dfCentralMeridian,
603  double dfFalseEasting, double dfFalseNorthing );
604 
606  OGRErr SetTM( double dfCenterLat, double dfCenterLong,
607  double dfScale,
608  double dfFalseEasting, double dfFalseNorthing );
609 
611  OGRErr SetTMVariant( const char *pszVariantName,
612  double dfCenterLat, double dfCenterLong,
613  double dfScale,
614  double dfFalseEasting, double dfFalseNorthing );
615 
617  OGRErr SetTMG( double dfCenterLat, double dfCenterLong,
618  double dfFalseEasting, double dfFalseNorthing );
619 
621  OGRErr SetTMSO( double dfCenterLat, double dfCenterLong,
622  double dfScale,
623  double dfFalseEasting, double dfFalseNorthing );
624 
626  OGRErr SetTPED( double dfLat1, double dfLong1,
627  double dfLat2, double dfLong2,
628  double dfFalseEasting, double dfFalseNorthing );
629 
631  OGRErr SetVDG( double dfCenterLong,
632  double dfFalseEasting, double dfFalseNorthing );
633 
635  OGRErr SetUTM( int nZone, int bNorth = TRUE );
636  int GetUTMZone( int *pbNorth = nullptr ) const;
637 
639  OGRErr SetWagner( int nVariation, double dfCenterLat,
640  double dfFalseEasting, double dfFalseNorthing );
641 
643  OGRErr SetQSC(double dfCenterLat, double dfCenterLong);
644 
646  OGRErr SetSCH( double dfPegLat, double dfPegLong,
647  double dfPegHeading, double dfPegHgt);
648 
650  OGRErr SetVerticalPerspective( double dfTopoOriginLat,
651  double dfTopoOriginLon,
652  double dfTopoOriginHeight,
653  double dfViewPointHeight,
654  double dfFalseEasting,
655  double dfFalseNorthing);
656 
658  OGRErr SetDerivedGeogCRSWithPoleRotationGRIBConvention(
659  const char* pszCRSName,
660  double dfSouthPoleLat,
661  double dfSouthPoleLon,
662  double dfAxisRotation );
663 
665  OGRErr SetStatePlane( int nZone, int bNAD83 = TRUE,
666  const char *pszOverrideUnitName = nullptr,
667  double dfOverrideUnit = 0.0 );
668 
670  OGRErr ImportFromESRIStatePlaneWKT(
671  int nCode, const char* pszDatumName, const char* pszUnitsName,
672  int nPCSCode, const char* pszCRSName = nullptr );
673 
675  OGRErr ImportFromESRIWisconsinWKT(
676  const char* pszPrjName, double dfCentralMeridian, double dfLatOfOrigin,
677  const char* pszUnitsName, const char* pszCRSName = nullptr );
678 
680  void UpdateCoordinateSystemFromGeogCRS();
683  static OGRSpatialReference* GetWGS84SRS();
684 
689  { return reinterpret_cast<OGRSpatialReferenceH>(poSRS); }
690 
695  { return reinterpret_cast<OGRSpatialReference*>(hSRS); }
696 
697 };
698 
699 /************************************************************************/
700 /* OGRCoordinateTransformation */
701 /* */
702 /* This is really just used as a base class for a private */
703 /* implementation. */
704 /************************************************************************/
705 
716 {
717 public:
718  virtual ~OGRCoordinateTransformation() {}
719 
720  static void DestroyCT(OGRCoordinateTransformation* poCT);
721 
722  // From CT_CoordinateTransformation
723 
725  virtual OGRSpatialReference *GetSourceCS() = 0;
726 
728  virtual OGRSpatialReference *GetTargetCS() = 0;
729 
731  virtual bool GetEmitErrors() const { return false; }
732 
734  virtual void SetEmitErrors(bool /*bEmitErrors*/) {}
735 
736  // From CT_MathTransform
737 
753  int Transform( int nCount,
754  double *x, double *y, double *z = nullptr,
755  int *pabSuccess = nullptr );
756 
773  virtual int Transform( int nCount,
774  double *x, double *y,
775  double *z, double *t,
776  int *pabSuccess ) = 0;
777 
782  { return reinterpret_cast<OGRCoordinateTransformationH>(poCT); }
783 
788  { return reinterpret_cast<OGRCoordinateTransformation*>(hCT); }
789 
793  virtual OGRCoordinateTransformation* Clone() const = 0;
794 };
795 
798  const OGRSpatialReference *poTarget );
799 
800 
808 {
810 private:
811  friend class OGRProjCT;
812  struct Private;
813  std::unique_ptr<Private> d;
816 public:
821 
822  bool SetAreaOfInterest(double dfWestLongitudeDeg,
823  double dfSouthLatitudeDeg,
824  double dfEastLongitudeDeg,
825  double dfNorthLatitudeDeg);
826 
827  bool SetCoordinateOperation(const char* pszCT, bool bReverseCT);
829  void SetSourceCenterLong(double dfCenterLong);
830  void SetTargetCenterLong(double dfCenterLong);
832 };
833 
834 
837  const OGRSpatialReference *poTarget,
838  const OGRCoordinateTransformationOptions& options );
839 
840 #endif /* ndef OGR_SPATIALREF_H_INCLUDED */
OGR_SRSNode::GetChildCount
int GetChildCount() const
Definition: ogr_spatialref.h:88
OGRCreateCoordinateTransformation
OGRCoordinateTransformation * OGRCreateCoordinateTransformation(const OGRSpatialReference *poSource, const OGRSpatialReference *poTarget)
Create transformation object.
Definition: ogrct.cpp:508
OGRCoordinateTransformationOptions
Context for coordinate transformation.
Definition: ogr_spatialref.h:807
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:157
OGRCoordinateTransformation::ToHandle
static OGRCoordinateTransformationH ToHandle(OGRCoordinateTransformation *poCT)
Convert a OGRCoordinateTransformation* to a OGRCoordinateTransformationH.
Definition: ogr_spatialref.h:781
OGR_SRSNode::IsLeafNode
int IsLeafNode() const
Return whether this is a leaf node.
Definition: ogr_spatialref.h:86
OGRSpatialReference::FromHandle
static OGRSpatialReference * FromHandle(OGRSpatialReferenceH hSRS)
Convert a OGRSpatialReferenceH to a OGRSpatialReference*.
Definition: ogr_spatialref.h:694
CPLString
Convenient string class based on std::string.
Definition: cpl_string.h:332
OGRSpatialReference::ToHandle
static OGRSpatialReferenceH ToHandle(OGRSpatialReference *poSRS)
Convert a OGRSpatialReference* to a OGRSpatialReferenceH.
Definition: ogr_spatialref.h:688
OSRAxisMappingStrategy
OSRAxisMappingStrategy
Data axis to CRS axis mapping strategy.
Definition: ogr_srs_api.h:658
OGR_SRSNode::GetValue
const char * GetValue() const
Definition: ogr_spatialref.h:102
OGRSpatialReferenceH
void * OGRSpatialReferenceH
Opaque type for a spatial reference system.
Definition: ogr_api.h:75
OGR_SRSNode::Listener
Listener that is notified of modification to nodes.
Definition: ogr_spatialref.h:70
OGRCoordinateTransformationH
void * OGRCoordinateTransformationH
Opaque type for a coordinate transformation object.
Definition: ogr_api.h:77
OGRCoordinateTransformation::SetEmitErrors
virtual void SetEmitErrors(bool)
Set if the transformer must emit CPLError.
Definition: ogr_spatialref.h:734
ogr_srs_api.h
cpl_string.h
OGRAxisOrientation
OGRAxisOrientation
Axis orientations (corresponds to CS_AxisOrientationEnum).
Definition: ogr_srs_api.h:48
OGRCoordinateTransformation
Interface for transforming between coordinate systems.
Definition: ogr_spatialref.h:715
OGRCoordinateTransformation::FromHandle
static OGRCoordinateTransformation * FromHandle(OGRCoordinateTransformationH hCT)
Convert a OGRCoordinateTransformationH to a OGRCoordinateTransformation*.
Definition: ogr_spatialref.h:787
OGRErr
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:318
OGRCoordinateTransformation::GetEmitErrors
virtual bool GetEmitErrors() const
Whether the transformer will emit CPLError.
Definition: ogr_spatialref.h:731
USGS_ANGLE_PACKEDDMS
#define USGS_ANGLE_PACKEDDMS
Angle is in packed degree minute second.
Definition: ogr_spatialref.h:223
OGR_SRSNode
Objects of this class are used to represent value nodes in the parsed representation of the WKT SRS f...
Definition: ogr_spatialref.h:66
CPL_DISALLOW_COPY_ASSIGN
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition: cpl_port.h:1003