32 #ifndef OGR_SPATIALREF_H_INCLUDED
33 #define OGR_SPATIALREF_H_INCLUDED
81 void RegisterListener(
const std::shared_ptr<Listener>& listener);
97 int FindChild(
const char * )
const;
98 void DestroyChild(
int );
100 void StripNodes(
const char * );
103 void SetValue(
const char * );
105 void MakeValueSafe();
109 OGRErr importFromWkt(
char ** )
111 CPL_WARN_DEPRECATED(
"Use importFromWkt(const char**)")
114 OGRErr importFromWkt(
const char ** );
115 OGRErr exportToWkt(
char ** )
const;
116 OGRErr exportToPrettyWkt(
char **,
int = 1)
const;
126 int NeedsQuoting()
const;
127 OGRErr importFromWkt(
const char **,
int nRecLevel,
int* pnNodes );
129 std::weak_ptr<Listener> m_listener{};
160 std::unique_ptr<Private> d;
162 void GetNormInfo()
const;
165 OGRErr importFromURNPart(
const char* pszAuthority,
169 static CPLString lookupInDict(
const char *pszDictFile,
170 const char *pszCode );
184 int GetReferenceCount()
const;
187 const char* GetName()
const;
193 OGRErr exportToWkt(
char ** )
const;
194 OGRErr exportToWkt(
char ** ppszWKT,
const char*
const* papszOptions )
const;
195 OGRErr exportToPrettyWkt(
char **,
int = FALSE)
const;
197 OGRErr exportToPROJJSON(
char **,
const char*
const* papszOptions )
const;
198 OGRErr exportToProj4(
char ** )
const;
199 OGRErr exportToPCI(
char **,
char **,
double ** )
const;
200 OGRErr exportToUSGS(
long *,
long *,
double **,
long * )
const;
201 OGRErr exportToXML(
char **,
const char * =
nullptr )
const;
202 OGRErr exportToPanorama(
long *,
long *,
long *,
long *,
204 OGRErr exportToERM(
char *pszProj,
char *pszDatum,
char *pszUnits );
205 OGRErr exportToMICoordSys(
char ** )
const;
208 OGRErr importFromWkt(
char ** )
210 CPL_WARN_DEPRECATED(
"Use importFromWkt(const char**) or importFromWkt(const char*)")
214 OGRErr importFromWkt(
const char ** );
215 OGRErr importFromWkt(
const char* );
216 OGRErr importFromProj4(
const char * );
217 OGRErr importFromEPSG(
int );
218 OGRErr importFromEPSGA(
int );
219 OGRErr importFromESRI(
char ** );
220 OGRErr importFromPCI(
const char *,
const char * =
nullptr,
221 double * =
nullptr );
223 #define USGS_ANGLE_DECIMALDEGREES 0
224 #define USGS_ANGLE_PACKEDDMS TRUE
225 #define USGS_ANGLE_RADIANS 2
226 OGRErr importFromUSGS(
long iProjSys,
long iZone,
227 double *padfPrjParams,
long iDatum,
229 OGRErr importFromPanorama(
long,
long,
long,
double* );
230 OGRErr importVertCSFromPanorama(
int );
231 OGRErr importFromOzi(
const char *
const* papszLines );
232 OGRErr importFromWMSAUTO(
const char *pszAutoDef );
233 OGRErr importFromXML(
const char * );
234 OGRErr importFromDict(
const char *pszDict,
const char *pszCode );
235 OGRErr importFromURN(
const char * );
236 OGRErr importFromCRSURL(
const char * );
237 OGRErr importFromERM(
const char *pszProj,
const char *pszDatum,
238 const char *pszUnits );
239 OGRErr importFromUrl(
const char * );
240 OGRErr importFromMICoordSys(
const char * );
246 const char* pszTargetProjection,
247 const char*
const* papszOptions =
nullptr )
const;
252 bool StripTOWGS84IfKnownDatumAndAllowed();
253 bool StripTOWGS84IfKnownDatum();
255 int EPSGTreatsAsLatLong()
const;
256 int EPSGTreatsAsNorthingEasting()
const;
257 int GetAxesCount()
const;
258 const char *GetAxis(
const char *pszTargetKey,
int iAxis,
260 OGRErr SetAxes(
const char *pszTargetKey,
261 const char *pszXAxisName,
263 const char *pszYAxisName,
268 const std::vector<int>& GetDataAxisToSRSAxisMapping()
const;
269 OGRErr SetDataAxisToSRSAxisMapping(
const std::vector<int>& mapping);
280 const OGR_SRSNode *GetAttrNode(
const char *)
const;
281 const char *GetAttrValue(
const char *,
int = 0)
const;
283 OGRErr SetNode(
const char *,
const char * );
284 OGRErr SetNode(
const char *,
double );
286 OGRErr SetLinearUnitsAndUpdateParameters(
const char *pszName,
288 const char *pszUnitAuthority =
nullptr,
289 const char *pszUnitCode =
nullptr );
290 OGRErr SetLinearUnits(
const char *pszName,
double dfInMeters );
291 OGRErr SetTargetLinearUnits(
const char *pszTargetKey,
294 const char *pszUnitAuthority =
nullptr,
295 const char *pszUnitCode =
nullptr);
297 double GetLinearUnits(
char ** )
const
299 CPL_WARN_DEPRECATED(
"Use GetLinearUnits(const char**) instead")
302 double GetLinearUnits(
const char ** =
nullptr )
const;
304 double GetLinearUnits( std::nullptr_t )
const
305 {
return GetLinearUnits(
static_cast<const char**
>(
nullptr) ); }
308 double GetTargetLinearUnits(
const char *pszTargetKey,
309 char ** ppszRetName )
const
311 CPL_WARN_DEPRECATED(
"Use GetTargetLinearUnits(const char*, const char**)")
314 double GetTargetLinearUnits(
const char *pszTargetKey,
315 const char ** ppszRetName =
nullptr )
const;
317 double GetTargetLinearUnits(
const char *pszTargetKey, std::nullptr_t )
const
318 {
return GetTargetLinearUnits( pszTargetKey,
static_cast<const char**
>(
nullptr) ); }
321 OGRErr SetAngularUnits(
const char *pszName,
double dfInRadians );
322 double GetAngularUnits(
char ** )
const
324 CPL_WARN_DEPRECATED(
"Use GetAngularUnits(const char**) instead")
327 double GetAngularUnits(
const char ** =
nullptr )
const;
329 double GetAngularUnits( std::nullptr_t )
const
330 {
return GetAngularUnits(
static_cast<const char**
>(
nullptr) ); }
333 double GetPrimeMeridian(
char ** )
const
335 CPL_WARN_DEPRECATED(
"Use GetPrimeMeridian(const char**) instead")
338 double GetPrimeMeridian(
const char ** =
nullptr )
const;
340 double GetPrimeMeridian( std::nullptr_t )
const
341 {
return GetPrimeMeridian(
static_cast<const char**
>(
nullptr) ); }
344 bool IsEmpty()
const;
345 int IsGeographic()
const;
346 int IsDerivedGeographic()
const;
347 int IsProjected()
const;
348 int IsGeocentric()
const;
350 int IsVertical()
const;
351 int IsCompound()
const;
354 const char*
const * papszOptions )
const;
358 const char*
const * papszOptions )
const;
361 OGRErr SetLocalCS(
const char * );
362 OGRErr SetProjCS(
const char * );
363 OGRErr SetProjection(
const char * );
364 OGRErr SetGeocCS(
const char * pszGeocName );
365 OGRErr SetGeogCS(
const char * pszGeogName,
366 const char * pszDatumName,
367 const char * pszEllipsoidName,
368 double dfSemiMajor,
double dfInvFlattening,
369 const char * pszPMName =
nullptr,
370 double dfPMOffset = 0.0,
371 const char * pszUnits =
nullptr,
372 double dfConvertToRadians = 0.0 );
373 OGRErr SetWellKnownGeogCS(
const char * );
375 OGRErr SetVertCS(
const char *pszVertCSName,
376 const char *pszVertDatumName,
377 int nVertDatumClass = 2005 );
378 OGRErr SetCompoundCS(
const char *pszName,
383 OGRErr PromoteTo3D(
const char* pszName );
385 OGRErr DemoteTo2D(
const char* pszName );
387 OGRErr SetFromUserInput(
const char * );
389 OGRErr SetTOWGS84(
double,
double,
double,
390 double = 0.0,
double = 0.0,
double = 0.0,
392 OGRErr GetTOWGS84(
double *padfCoef,
int nCoeff = 7 )
const;
393 OGRErr AddGuessedTOWGS84();
395 double GetSemiMajor(
OGRErr * =
nullptr )
const;
396 double GetSemiMinor(
OGRErr * =
nullptr )
const;
397 double GetInvFlattening(
OGRErr * =
nullptr )
const;
398 double GetEccentricity()
const;
399 double GetSquaredEccentricity()
const;
401 OGRErr SetAuthority(
const char * pszTargetKey,
402 const char * pszAuthority,
405 OGRErr AutoIdentifyEPSG();
408 int** ppanMatchConfidence )
const;
410 int GetEPSGGeogCS()
const;
412 const char *GetAuthorityCode(
const char * pszTargetKey )
const;
413 const char *GetAuthorityName(
const char * pszTargetKey )
const;
415 bool GetAreaOfUse(
double* pdfWestLongitudeDeg,
416 double* pdfSouthLatitudeDeg,
417 double* pdfEastLongitudeDeg,
418 double* pdfNorthLatitudeDeg,
419 const char **ppszAreaName )
const;
421 const char *GetExtension(
const char *pszTargetKey,
423 const char *pszDefault =
nullptr )
const;
424 OGRErr SetExtension(
const char *pszTargetKey,
426 const char *pszValue );
428 int FindProjParm(
const char *pszParameter,
430 OGRErr SetProjParm(
const char *,
double );
431 double GetProjParm(
const char *,
double =0.0,
OGRErr* =
nullptr )
const;
433 OGRErr SetNormProjParm(
const char *,
double );
434 double GetNormProjParm(
const char *,
double=0.0,
OGRErr* =
nullptr)
const;
436 static int IsAngularParameter(
const char * );
437 static int IsLongitudeParameter(
const char * );
438 static int IsLinearParameter(
const char * );
441 OGRErr SetACEA(
double dfStdP1,
double dfStdP2,
442 double dfCenterLat,
double dfCenterLong,
443 double dfFalseEasting,
double dfFalseNorthing );
446 OGRErr SetAE(
double dfCenterLat,
double dfCenterLong,
447 double dfFalseEasting,
double dfFalseNorthing );
450 OGRErr SetBonne(
double dfStdP1,
double dfCentralMeridian,
451 double dfFalseEasting,
double dfFalseNorthing );
454 OGRErr SetCEA(
double dfStdP1,
double dfCentralMeridian,
455 double dfFalseEasting,
double dfFalseNorthing );
458 OGRErr SetCS(
double dfCenterLat,
double dfCenterLong,
459 double dfFalseEasting,
double dfFalseNorthing );
462 OGRErr SetEC(
double dfStdP1,
double dfStdP2,
463 double dfCenterLat,
double dfCenterLong,
464 double dfFalseEasting,
double dfFalseNorthing );
467 OGRErr SetEckert(
int nVariation,
double dfCentralMeridian,
468 double dfFalseEasting,
double dfFalseNorthing );
471 OGRErr SetEckertIV(
double dfCentralMeridian,
472 double dfFalseEasting,
double dfFalseNorthing );
475 OGRErr SetEckertVI(
double dfCentralMeridian,
476 double dfFalseEasting,
double dfFalseNorthing );
479 OGRErr SetEquirectangular(
double dfCenterLat,
double dfCenterLong,
480 double dfFalseEasting,
double dfFalseNorthing );
482 OGRErr SetEquirectangular2(
double dfCenterLat,
double dfCenterLong,
483 double dfPseudoStdParallel1,
484 double dfFalseEasting,
double dfFalseNorthing );
487 OGRErr SetGEOS(
double dfCentralMeridian,
double dfSatelliteHeight,
488 double dfFalseEasting,
double dfFalseNorthing );
491 OGRErr SetGH(
double dfCentralMeridian,
492 double dfFalseEasting,
double dfFalseNorthing );
498 OGRErr SetGS(
double dfCentralMeridian,
499 double dfFalseEasting,
double dfFalseNorthing );
502 OGRErr SetGaussSchreiberTMercator(
double dfCenterLat,
double dfCenterLong,
504 double dfFalseEasting,
double dfFalseNorthing );
507 OGRErr SetGnomonic(
double dfCenterLat,
double dfCenterLong,
508 double dfFalseEasting,
double dfFalseNorthing );
511 OGRErr SetHOM(
double dfCenterLat,
double dfCenterLong,
512 double dfAzimuth,
double dfRectToSkew,
514 double dfFalseEasting,
double dfFalseNorthing );
517 OGRErr SetHOM2PNO(
double dfCenterLat,
518 double dfLat1,
double dfLong1,
519 double dfLat2,
double dfLong2,
521 double dfFalseEasting,
double dfFalseNorthing );
524 OGRErr SetHOMAC(
double dfCenterLat,
double dfCenterLong,
525 double dfAzimuth,
double dfRectToSkew,
527 double dfFalseEasting,
double dfFalseNorthing );
530 OGRErr SetLOM(
double dfCenterLat,
double dfCenterLong,
533 double dfFalseEasting,
double dfFalseNorthing );
536 OGRErr SetIWMPolyconic(
double dfLat1,
double dfLat2,
538 double dfFalseEasting,
539 double dfFalseNorthing );
542 OGRErr SetKrovak(
double dfCenterLat,
double dfCenterLong,
543 double dfAzimuth,
double dfPseudoStdParallelLat,
545 double dfFalseEasting,
double dfFalseNorthing );
548 OGRErr SetLAEA(
double dfCenterLat,
double dfCenterLong,
549 double dfFalseEasting,
double dfFalseNorthing );
552 OGRErr SetLCC(
double dfStdP1,
double dfStdP2,
553 double dfCenterLat,
double dfCenterLong,
554 double dfFalseEasting,
double dfFalseNorthing );
557 OGRErr SetLCC1SP(
double dfCenterLat,
double dfCenterLong,
559 double dfFalseEasting,
double dfFalseNorthing );
562 OGRErr SetLCCB(
double dfStdP1,
double dfStdP2,
563 double dfCenterLat,
double dfCenterLong,
564 double dfFalseEasting,
double dfFalseNorthing );
567 OGRErr SetMC(
double dfCenterLat,
double dfCenterLong,
568 double dfFalseEasting,
double dfFalseNorthing );
571 OGRErr SetMercator(
double dfCenterLat,
double dfCenterLong,
573 double dfFalseEasting,
double dfFalseNorthing );
576 OGRErr SetMercator2SP(
double dfStdP1,
577 double dfCenterLat,
double dfCenterLong,
578 double dfFalseEasting,
double dfFalseNorthing );
581 OGRErr SetMollweide(
double dfCentralMeridian,
582 double dfFalseEasting,
double dfFalseNorthing );
585 OGRErr SetNZMG(
double dfCenterLat,
double dfCenterLong,
586 double dfFalseEasting,
double dfFalseNorthing );
589 OGRErr SetOS(
double dfOriginLat,
double dfCMeridian,
591 double dfFalseEasting,
double dfFalseNorthing);
594 OGRErr SetOrthographic(
double dfCenterLat,
double dfCenterLong,
595 double dfFalseEasting,
double dfFalseNorthing);
598 OGRErr SetPolyconic(
double dfCenterLat,
double dfCenterLong,
599 double dfFalseEasting,
double dfFalseNorthing );
602 OGRErr SetPS(
double dfCenterLat,
double dfCenterLong,
604 double dfFalseEasting,
double dfFalseNorthing);
607 OGRErr SetRobinson(
double dfCenterLong,
608 double dfFalseEasting,
double dfFalseNorthing );
611 OGRErr SetSinusoidal(
double dfCenterLong,
612 double dfFalseEasting,
double dfFalseNorthing );
615 OGRErr SetStereographic(
double dfCenterLat,
double dfCenterLong,
617 double dfFalseEasting,
double dfFalseNorthing);
620 OGRErr SetSOC(
double dfLatitudeOfOrigin,
double dfCentralMeridian,
621 double dfFalseEasting,
double dfFalseNorthing );
624 OGRErr SetTM(
double dfCenterLat,
double dfCenterLong,
626 double dfFalseEasting,
double dfFalseNorthing );
629 OGRErr SetTMVariant(
const char *pszVariantName,
630 double dfCenterLat,
double dfCenterLong,
632 double dfFalseEasting,
double dfFalseNorthing );
635 OGRErr SetTMG(
double dfCenterLat,
double dfCenterLong,
636 double dfFalseEasting,
double dfFalseNorthing );
639 OGRErr SetTMSO(
double dfCenterLat,
double dfCenterLong,
641 double dfFalseEasting,
double dfFalseNorthing );
644 OGRErr SetTPED(
double dfLat1,
double dfLong1,
645 double dfLat2,
double dfLong2,
646 double dfFalseEasting,
double dfFalseNorthing );
649 OGRErr SetVDG(
double dfCenterLong,
650 double dfFalseEasting,
double dfFalseNorthing );
653 OGRErr SetUTM(
int nZone,
int bNorth = TRUE );
654 int GetUTMZone(
int *pbNorth =
nullptr )
const;
657 OGRErr SetWagner(
int nVariation,
double dfCenterLat,
658 double dfFalseEasting,
double dfFalseNorthing );
661 OGRErr SetQSC(
double dfCenterLat,
double dfCenterLong);
664 OGRErr SetSCH(
double dfPegLat,
double dfPegLong,
665 double dfPegHeading,
double dfPegHgt);
668 OGRErr SetVerticalPerspective(
double dfTopoOriginLat,
669 double dfTopoOriginLon,
670 double dfTopoOriginHeight,
671 double dfViewPointHeight,
672 double dfFalseEasting,
673 double dfFalseNorthing);
676 OGRErr SetDerivedGeogCRSWithPoleRotationGRIBConvention(
677 const char* pszCRSName,
678 double dfSouthPoleLat,
679 double dfSouthPoleLon,
680 double dfAxisRotation );
683 OGRErr SetStatePlane(
int nZone,
int bNAD83 = TRUE,
684 const char *pszOverrideUnitName =
nullptr,
685 double dfOverrideUnit = 0.0 );
688 OGRErr ImportFromESRIStatePlaneWKT(
689 int nCode,
const char* pszDatumName,
const char* pszUnitsName,
690 int nPCSCode,
const char* pszCRSName =
nullptr );
693 OGRErr ImportFromESRIWisconsinWKT(
694 const char* pszPrjName,
double dfCentralMeridian,
double dfLatOfOrigin,
695 const char* pszUnitsName,
const char* pszCRSName =
nullptr );
698 void UpdateCoordinateSystemFromGeogCRS();
772 double *x,
double *y,
double *z =
nullptr,
773 int *pabSuccess =
nullptr );
792 double *x,
double *y,
793 double *z,
double *t,
794 int *pabSuccess ) = 0;
814 double *x,
double *y,
815 double *z,
double *t,
816 int *panErrorCodes );
862 friend class OGRProjCT;
864 std::unique_ptr<Private> d;
873 bool SetAreaOfInterest(
double dfWestLongitudeDeg,
874 double dfSouthLatitudeDeg,
875 double dfEastLongitudeDeg,
876 double dfNorthLatitudeDeg);
877 bool SetDesiredAccuracy(
double dfAccuracy);
878 bool SetBallparkAllowed(
bool bAllowBallpark);
880 bool SetCoordinateOperation(
const char* pszCT,
bool bReverseCT);
882 void SetSourceCenterLong(
double dfCenterLong);
883 void SetTargetCenterLong(
double dfCenterLong);
Convenient string class based on std::string.
Definition: cpl_string.h:333
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:158
static OGRSpatialReference * FromHandle(OGRSpatialReferenceH hSRS)
Convert a OGRSpatialReferenceH to a OGRSpatialReference*.
Definition: ogr_spatialref.h:712
static OGRSpatialReferenceH ToHandle(OGRSpatialReference *poSRS)
Convert a OGRSpatialReference* to a OGRSpatialReferenceH.
Definition: ogr_spatialref.h:706
Objects of this class are used to represent value nodes in the parsed representation of the WKT SRS f...
Definition: ogr_spatialref.h:67
int GetChildCount() const
Get number of children nodes.
Definition: ogr_spatialref.h:88
const char * GetValue() const
Fetch value string for this node.
Definition: ogr_spatialref.h:102
int IsLeafNode() const
Return whether this is a leaf node.
Definition: ogr_spatialref.h:86
#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:1007
Various convenience functions for working with strings and string lists.
void * OGRCoordinateTransformationH
Opaque type for a coordinate transformation object.
Definition: ogr_api.h:80
void * OGRSpatialReferenceH
Opaque type for a spatial reference system.
Definition: ogr_api.h:78
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:318
#define USGS_ANGLE_PACKEDDMS
Angle is in packed degree minute second.
Definition: ogr_spatialref.h:224
OGRCoordinateTransformation * OGRCreateCoordinateTransformation(const OGRSpatialReference *poSource, const OGRSpatialReference *poTarget)
Create transformation object.
Definition: ogrct.cpp:743
C spatial reference system services and defines.
OSRAxisMappingStrategy
Data axis to CRS axis mapping strategy.
Definition: ogr_srs_api.h:662
OGRAxisOrientation
Axis orientations (corresponds to CS_AxisOrientationEnum).
Definition: ogr_srs_api.h:48
Listener that is notified of modification to nodes.
Definition: ogr_spatialref.h:71
virtual void notifyChange(OGR_SRSNode *)=0
Method triggered when a node is modified.