# Spatial Reference System C++ API

## Include file

ogr_spatialref.h

## Spatial Reference System C++ API

Coordinate systems services.

Defines

USGS_ANGLE_DECIMALDEGREES

  Angle is in decimal degrees.

USGS_ANGLE_PACKEDDMS

  Angle is in packed degree minute second.

USGS_ANGLE_RADIANS

  Angle is in radians.

Functions

OGRCoordinateTransformation *OGRCreateCoordinateTransformation(const OGRSpatialReference *poSource, const OGRSpatialReference *poTarget)

  Create transformation object.

  This is the same as the C function OCTNewCoordinateTransformation().

  Input spatial reference system objects are assigned by copy (calling clone() method) and no ownership transfer occurs.

  The delete operator, or OCTDestroyCoordinateTransformation() should be used to destroy transformation objects.

  This will honour the axis order advertized by the source and target SRS, as well as their "data axis to SRS axis mapping". To have a behavior similar to GDAL < 3.0, the OGR_CT_FORCE_TRADITIONAL_GIS_ORDER configuration option can be set to YES.

  Parameters:

    - poSource -- source spatial reference system.

    - poTarget -- target spatial reference system.

  Returns:

    NULL on failure or a ready to use transformation object.

OGRCoordinateTransformation *OGRCreateCoordinateTransformation(const OGRSpatialReference *poSource, const OGRSpatialReference *poTarget, const OGRCoordinateTransformationOptions &options)

  Create transformation object.

  This is the same as the C function OCTNewCoordinateTransformationEx().

  Input spatial reference system objects are assigned by copy (calling clone() method) and no ownership transfer occurs.

  The delete operator, or OCTDestroyCoordinateTransformation() should be used to destroy transformation objects.

  This will honour the axis order advertized by the source and target SRS, as well as their "data axis to SRS axis mapping". To have a behavior similar to GDAL < 3.0, the OGR_CT_FORCE_TRADITIONAL_GIS_ORDER configuration option can be set to YES.

  The source SRS and target SRS should generally not be NULL. This is only allowed if a custom coordinate operation is set through the hOptions argument.

  Starting with GDAL 3.0.3, the OGR_CT_OP_SELECTION configuration option can be set to PROJ (default if PROJ >= 6.3), BEST_ACCURACY or FIRST_MATCHING to decide of the strategy to select the operation to use among candidates, whose area of use is compatible with the points to transform. It is only taken into account if no user defined coordinate transformation pipeline has been specified.

  - PROJ means the default behavior used by PROJ proj_create_crs_to_crs(). In particular the operation to use among several initial candidates is evaluated for each point to transform.

  - BEST_ACCURACY means the operation whose accuracy is best. It should be close to PROJ behavior, except that the operation to select is decided for the average point of the coordinates passed in a single Transform() call. Note: if the OGRCoordinateTransformationOptions::SetDesiredAccuracy() or OGRCoordinateTransformationOptions::SetBallparkAllowed() methods are called with PROJ < 8, this strategy will be selected instead of PROJ.

  - FIRST_MATCHING is the operation ordered first in the list of candidates: it will not necessarily have the best accuracy, but generally a larger area of use. It is evaluated for the average point of the coordinates passed in a single Transform() call. This was the default behavior for GDAL 3.0.0 to 3.0.2

  By default, if the source or target SRS definition refers to an official CRS through a code, GDAL will use the official definition if the official definition and the source/target SRS definition are equivalent. Note that TOWGS84[] clauses are ignored when checking equivalence. Starting with GDAL 3.4.1, if you set the OGR_CT_PREFER_OFFICIAL_SRS_DEF configuration option to NO, the source or target SRS definition will be always used.

  If options contains a user defined coordinate transformation pipeline, it will be unconditionally used. If options has an area of interest defined, it will be used to research the best fitting coordinate transformation (which will be used for all coordinate transformations, even if they don't fall into the declared area of interest) If no options are set, then a list of candidate coordinate operations will be researched, and at each call to Transform(), the best of those candidate regarding the centroid of the coordinate set will be dynamically selected.

  Since

    GDAL 3.0

  Parameters:

    - poSource -- source spatial reference system.

    - poTarget -- target spatial reference system.

    - options -- Coordinate transformation options.

  Returns:

    NULL on failure or a ready to use transformation object.

class OGR_SRSNode
  #include <ogr_spatialref.h>

  Objects of this class are used to represent value nodes in the parsed representation of the WKT SRS format.

  For instance UNIT["METER",1] would be rendered into three OGR_SRSNodes. The root node would have a value of UNIT, and two children, the first with a value of METER, and the second with a value of 1.

  Normally application code just interacts with the OGRSpatialReference object, which uses the OGR_SRSNode to implement its data structure; however, this class is user accessible for detailed access to components of an SRS definition.

  Public Functions

  explicit OGR_SRSNode(const char* = nullptr)

    Constructor.

    Parameters:

      pszValueIn -- this optional parameter can be used to initialize the value of the node upon creation. If omitted the node will be created with a value of "". Newly created OGR_SRSNodes have no children.

  ~OGR_SRSNode()
  void RegisterListener(const std::shared_ptr<Listener> &listener)

    Register a (single) listener.

  inline int IsLeafNode() const

    Return whether this is a leaf node.

    Returns:

      TRUE or FALSE

  inline int GetChildCount() const

    Get number of children nodes.

    Returns:

      0 for leaf nodes, or the number of children nodes.

  OGR_SRSNode *GetChild(int)

    Fetch requested child.

    Parameters:

      iChild -- the index of the child to fetch, from 0 to GetChildCount() - 1.

    Returns:

      a pointer to the child OGR_SRSNode, or NULL if there is no such child.

  const OGR_SRSNode *GetChild(int) const

    Fetch requested child.

    Parameters:

      iChild -- the index of the child to fetch, from 0 to GetChildCount() - 1.

    Returns:

      a pointer to the child OGR_SRSNode, or NULL if there is no such child.

  OGR_SRSNode *GetNode(const char*)

    Find named node in tree.

    This method does a pre-order traversal of the node tree searching for a node with this exact value (case insensitive), and returns it. Leaf nodes are not considered, under the assumption that they are just attribute value nodes.

    If a node appears more than once in the tree (such as UNIT for instance), the first encountered will be returned. Use GetNode() on a subtree to be more specific.

    Parameters:

      pszName -- the name of the node to search for.

    Returns:

      a pointer to the node found, or NULL if none.

  const OGR_SRSNode *GetNode(const char*) const

    Find named node in tree.

    This method does a pre-order traversal of the node tree searching for a node with this exact value (case insensitive), and returns it. Leaf nodes are not considered, under the assumption that they are just attribute value nodes.

    If a node appears more than once in the tree (such as UNIT for instance), the first encountered will be returned. Use GetNode() on a subtree to be more specific.

    Parameters:

      pszName -- the name of the node to search for.

    Returns:

      a pointer to the node found, or NULL if none.

  void InsertChild(OGR_SRSNode*, int)

    Insert the passed node as a child of target node, at the indicated position.

    Note that ownership of the passed node is assumed by the node on which the method is invoked ... use the Clone() method if the original is to be preserved. All existing children at location iChild and beyond are push down one space to make space for the new child.

    Parameters:

      - poNew -- the node to add as a child.

      - iChild -- position to insert, use 0 to insert at the beginning.

  void AddChild(OGR_SRSNode*)

    Add passed node as a child of target node.

    Note that ownership of the passed node is assumed by the node on which the method is invoked ... use the Clone() method if the original is to be preserved. New children are always added at the end of the list.

    Parameters:

      poNew -- the node to add as a child.

  int FindChild(const char*) const

    Find the index of the child matching the given string.

    Note that the node value must match pszValue with the exception of case. The comparison is case insensitive.

    Parameters:

      pszValueIn -- the node value being searched for.

    Returns:

      the child index, or -1 on failure.

  void DestroyChild(int)

    Remove a child node, and it's subtree.

    Note that removing a child node will result in children after it being renumbered down one.

    Parameters:

      iChild -- the index of the child.

  void ClearChildren()

    Clear children nodes.

  void StripNodes(const char*)

    Strip child nodes matching name.

    Removes any descendant nodes of this node that match the given name. Of course children of removed nodes are also discarded.

    Parameters:

      pszName -- the name for nodes that should be removed.

  inline const char *GetValue() const

    Fetch value string for this node.

    Returns:

      A non-NULL string is always returned. The returned pointer is to the internal value of this node, and should not be modified, or freed.

  void SetValue(const char*)

    Set the node value.

    Parameters:

      pszNewValue -- the new value to assign to this node. The passed string is duplicated and remains the responsibility of the caller.

  void MakeValueSafe()

    Massage value string, stripping special characters so it will be a database safe string.

    The operation is also applies to all subnodes of the current node.

  OGR_SRSNode *Clone() const

    Make a duplicate of this node, and it's children.

    Returns:

      a new node tree, which becomes the responsibility of the caller.

  OGRErr importFromWkt(char**)

    Import from WKT string.

    This method will wipe the existing children and value of this node, and reassign them based on the contents of the passed WKT string. Only as much of the input string as needed to construct this node, and its children is consumed from the input string, and the input string pointer is then updated to point to the remaining (unused) input.

    Deprecated:

      Use importFromWkt(const char**) instead.

    Parameters:

      ppszInput -- Pointer to pointer to input. The pointer is updated to point to remaining unused input text.

    Returns:

      OGRERR_NONE if import succeeds, or OGRERR_CORRUPT_DATA if it fails for any reason.

  OGRErr importFromWkt(const char**)

    Import from WKT string.

    This method will wipe the existing children and value of this node, and reassign them based on the contents of the passed WKT string. Only as much of the input string as needed to construct this node, and its children is consumed from the input string, and the input string pointer is then updated to point to the remaining (unused) input.

    Parameters:

      ppszInput -- Pointer to pointer to input. The pointer is updated to point to remaining unused input text.

    Returns:

      OGRERR_NONE if import succeeds, or OGRERR_CORRUPT_DATA if it fails for any reason.

  OGRErr exportToWkt(char**) const

    Convert this tree of nodes into WKT format.

    Note that the returned WKT string should be freed with CPLFree() when no longer needed. It is the responsibility of the caller.

    Parameters:

      ppszResult -- the resulting string is returned in this pointer.

    Returns:

      currently OGRERR_NONE is always returned, but the future it is possible error conditions will develop.

  OGRErr exportToPrettyWkt(char**, int = 1) const

    Convert this tree of nodes into pretty WKT format.

    Note that the returned WKT string should be freed with CPLFree() when no longer needed. It is the responsibility of the caller.

    Parameters:

      - ppszResult -- the resulting string is returned in this pointer.

      - nDepth -- depth of the node

    Returns:

      currently OGRERR_NONE is always returned, but the future it is possible error conditions will develop.

  Private Functions

  int NeedsQuoting() const
  OGRErr importFromWkt(const char**, int nRecLevel, int *pnNodes)
  void notifyChange()

  Private Members

  char *pszValue
  OGR_SRSNode **papoChildNodes
  OGR_SRSNode *poParent
  int nChildren
  std::weak_ptr<Listener> m_listener = {}
  struct Listener
    #include <ogr_spatialref.h>

    Listener that is notified of modification to nodes.

    Subclassed by OGRSpatialReference::Private::Listener

    Public Functions

    virtual ~Listener()
    virtual void notifyChange(OGR_SRSNode*) = 0

      Method triggered when a node is modified.

class OGRSpatialReference
  #include <ogr_spatialref.h>

  This class represents an OpenGIS Spatial Reference System, and contains methods for converting between this object organization and well known text (WKT) format.

  This object is reference counted as one instance of the object is normally shared between many OGRGeometry objects.

  Normally application code can fetch needed parameter values for this SRS using GetAttrValue(), but in special cases the underlying parse tree (or OGR_SRSNode objects) can be accessed more directly.

  See the tutorial for more information on how to use this class.

  Consult also the OGC WKT Coordinate System Issues page for implementation details of WKT in OGR.

  Public Functions

  explicit OGRSpatialReference(const char* = nullptr)

    Constructor.

    This constructor takes an optional string argument which if passed should be a WKT representation of an SRS. Passing this is equivalent to not passing it, and then calling importFromWkt() with the WKT string.

    Note that newly created objects are given a reference count of one.

    Starting with GDAL 3.0, coordinates associated with a OGRSpatialReference object are assumed to be in the order of the axis of the CRS definition (which for example means latitude first, longitude second for geographic CRS belonging to the EPSG authority). It is possible to define a data axis to CRS axis mapping strategy with the SetAxisMappingStrategy() method.

    Starting with GDAL 3.5, the OSR_DEFAULT_AXIS_MAPPING_STRATEGY configuration option can be set to "TRADITIONAL_GIS_ORDER" / "AUTHORITY_COMPLIANT" (the later being the default value when the option is not set) to control the value of the data axis to CRS axis mapping strategy when a OSRSpatialReference object is created. Calling SetAxisMappingStrategy() will override this default value.

    The C function OSRNewSpatialReference() does the same thing as this constructor.

    Parameters:

      pszWKT -- well known text definition to which the object should be initialized, or NULL (the default).

  OGRSpatialReference(const OGRSpatialReference&)

    Copy constructor.

    See also Clone().

    Parameters:

      oOther -- other spatial reference

  OGRSpatialReference(OGRSpatialReference&&)

    Move constructor.

    Parameters:

      oOther -- other spatial reference

  virtual ~OGRSpatialReference()

    OGRSpatialReference destructor.

    The C function OSRDestroySpatialReference() does the same thing as this method. Preferred C++ method : OGRSpatialReference::DestroySpatialReference()

    Deprecated:
  OGRSpatialReference &operator=(const OGRSpatialReference&)

    Assignment operator.

    Parameters:

      oSource -- SRS to assign to *this

    Returns:

      *this

  OGRSpatialReference &operator=(OGRSpatialReference&&)

    Move assignment operator.

    Parameters:

      oSource -- SRS to assign to *this

    Returns:

      *this

  OGRSpatialReference &AssignAndSetThreadSafe(const OGRSpatialReference&)

    Assignment method, with thread-safety.

    Same as an assignment operator, but asking also that the *this instance becomes thread-safe.

    Since

      3.10

    Parameters:

      oSource -- SRS to assign to *this

    Returns:

      *this

  int Reference()

    Increments the reference count by one.

    The reference count is used keep track of the number of OGRGeometry objects referencing this SRS.

    The method does the same thing as the C function OSRReference().

    Returns:

      the updated reference count.

  int Dereference()

    Decrements the reference count by one.

    The method does the same thing as the C function OSRDereference().

    Returns:

      the updated reference count.

  int GetReferenceCount() const

    Fetch current reference count.

    Returns:

      the current reference count.

  void Release()

    Decrements the reference count by one, and destroy if zero.

    The method does the same thing as the C function OSRRelease().

  const char *GetName() const

    Return the CRS name.

    The returned value is only short lived and should not be used after other calls to methods on this object.

    Since

      GDAL 3.0

  OGRSpatialReference *Clone() const

    Make a duplicate of this OGRSpatialReference.

    This method is the same as the C function OSRClone().

    Returns:

      a new SRS, which becomes the responsibility of the caller.

  OGRSpatialReference *CloneGeogCS() const

    Make a duplicate of the GEOGCS node of this OGRSpatialReference object.

    Returns:

      a new SRS, which becomes the responsibility of the caller.

  void dumpReadable()

    Dump pretty wkt to stdout, mostly for debugging.

  OGRErr exportToWkt(char**) const

    Convert this SRS into WKT 1 format.

    Consult also the OGC WKT Coordinate System Issues page for implementation details of WKT 1 in OGR.

    Note that the returned WKT string should be freed with CPLFree() when no longer needed. It is the responsibility of the caller.

    The WKT version can be overridden by using the OSR_WKT_FORMAT configuration option. Valid values are the one of the FORMAT option of exportToWkt( char ** ppszResult, const char* const* papszOptions ) const

    This method is the same as the C function OSRExportToWkt().

    Parameters:

      ppszResult -- the resulting string is returned in this pointer.

    Returns:

      OGRERR_NONE if successful.

  OGRErr exportToWkt(char **ppszWKT, const char *const *papszOptions) const

    Convert this SRS into a WKT string.

    Note that the returned WKT string should be freed with CPLFree() when no longer needed. It is the responsibility of the caller.

    Consult also the OGC WKT Coordinate System Issues page for implementation details of WKT 1 in OGR.

    Starting with GDAL 3.0.3, if the OSR_ADD_TOWGS84_ON_EXPORT_TO_WKT1 configuration option is set to YES, when exporting to WKT1_GDAL, this method will try to add a TOWGS84[] node, if there's none attached yet to the SRS and if the SRS has a EPSG code. See the AddGuessedTOWGS84() method for how this TOWGS84[] node may be added.

    Since

      GDAL 3.0

    Parameters:

      - ppszResult -- the resulting string is returned in this pointer.

      - papszOptions -- NULL terminated list of options, or NULL. Currently supported options are

        - MULTILINE=YES/NO. Defaults to NO.

        - FORMAT=SFSQL/WKT1_SIMPLE/WKT1/WKT1_GDAL/WKT1_ESRI/WKT2_2015/WKT2_2018/WKT2/DEFAULT. If SFSQL, a WKT1 string without AXIS, TOWGS84, AUTHORITY or EXTENSION node is returned. If WKT1_SIMPLE, a WKT1 string without AXIS, AUTHORITY or EXTENSION node is returned. WKT1 is an alias of WKT1_GDAL. WKT2 will default to the latest revision implemented (currently WKT2_2018) WKT2_2019 can be used as an alias of WKT2_2018 since GDAL 3.2

        - ALLOW_ELLIPSOIDAL_HEIGHT_AS_VERTICAL_CRS=YES/NO. Default is NO. If set to YES and FORMAT=WKT1_GDAL, a Geographic 3D CRS or a Projected 3D CRS will be exported as a compound CRS whose vertical part represents an ellipsoidal height (for example for use with LAS 1.4 WKT1). Requires PROJ 7.2.1 and GDAL 3.2.1.

    Returns:

      OGRERR_NONE if successful.

  std::string exportToWkt(const char *const *papszOptions = nullptr) const

    Convert this SRS into a WKT string.

    Consult also the OGC WKT Coordinate System Issues page for implementation details of WKT 1 in OGR.

    If the OSR_ADD_TOWGS84_ON_EXPORT_TO_WKT1 configuration option is set to YES, when exporting to WKT1_GDAL, this method will try to add a TOWGS84[] node, if there's none attached yet to the SRS and if the SRS has a EPSG code. See the AddGuessedTOWGS84() method for how this TOWGS84[] node may be added.

    Since

      GDAL 3.9

    Parameters:

      papszOptions -- NULL terminated list of options, or NULL. Currently supported options are

      - MULTILINE=YES/NO. Defaults to NO.

      - FORMAT=SFSQL/WKT1_SIMPLE/WKT1/WKT1_GDAL/WKT1_ESRI/WKT2_2015/WKT2_2018/WKT2/DEFAULT. If SFSQL, a WKT1 string without AXIS, TOWGS84, AUTHORITY or EXTENSION node is returned. If WKT1_SIMPLE, a WKT1 string without AXIS, AUTHORITY or EXTENSION node is returned. WKT1 is an alias of WKT1_GDAL. WKT2 will default to the latest revision implemented (currently WKT2_2019)

      - ALLOW_ELLIPSOIDAL_HEIGHT_AS_VERTICAL_CRS=YES/NO. Default is NO. If set to YES and FORMAT=WKT1_GDAL, a Geographic 3D CRS or a Projected 3D CRS will be exported as a compound CRS whose vertical part represents an ellipsoidal height (for example for use with LAS 1.4 WKT1). Requires PROJ 7.2.1.

    Returns:

      a non-empty string if successful.

  OGRErr exportToPrettyWkt(char**, int = FALSE) const

    Convert this SRS into a nicely formatted WKT 1 string for display to a person.

    Consult also the OGC WKT Coordinate System Issues page for implementation details of WKT 1 in OGR.

    Note that the returned WKT string should be freed with CPLFree() when no longer needed. It is the responsibility of the caller.

    The WKT version can be overridden by using the OSR_WKT_FORMAT configuration option. Valid values are the one of the FORMAT option of exportToWkt( char ** ppszResult, const char* const* papszOptions ) const

    This method is the same as the C function OSRExportToPrettyWkt().

    Parameters:

      - ppszResult -- the resulting string is returned in this pointer.

      - bSimplify -- TRUE if the AXIS, AUTHORITY and EXTENSION nodes should be stripped off.

    Returns:

      OGRERR_NONE if successful.

  OGRErr exportToPROJJSON(char**, const char *const *papszOptions) const

    Convert this SRS into a PROJJSON string.

    Note that the returned JSON string should be freed with CPLFree() when no longer needed. It is the responsibility of the caller.

    Since

      GDAL 3.1 and PROJ 6.2

    Parameters:

      - ppszResult -- the resulting string is returned in this pointer.

      - papszOptions -- NULL terminated list of options, or NULL. Currently supported options are

        - MULTILINE=YES/NO. Defaults to YES

        - INDENTATION_WIDTH=number. Defaults to 2 (when multiline output is on).

        - SCHEMA=string. URL to PROJJSON schema. Can be set to empty string to disable it.

    Returns:

      OGRERR_NONE if successful.

  OGRErr exportToProj4(char**) const

    Export coordinate system in PROJ.4 legacy format.

    Converts the loaded coordinate reference system into PROJ format to the extent possible. The string returned in ppszProj4 should be deallocated by the caller with CPLFree() when no longer needed.

    LOCAL_CS coordinate systems are not translatable. An empty string will be returned along with OGRERR_NONE.

    Special processing for Transverse Mercator: Starting with GDAL 3.0, if the OSR_USE_APPROX_TMERC configuration option is set to YES, the PROJ definition built from the SRS will use the +approx flag for the tmerc and utm projection methods, rather than the more accurate method.

    Starting with GDAL 3.0.3, this method will try to add a +towgs84 parameter, if there's none attached yet to the SRS and if the SRS has a EPSG code. See the AddGuessedTOWGS84() method for how this +towgs84 parameter may be added. This automatic addition may be disabled by setting the OSR_ADD_TOWGS84_ON_EXPORT_TO_PROJ4 configuration option to NO.

    This method is the equivalent of the C function OSRExportToProj4().

    Warning

    Use of this function is discouraged. Its behavior in GDAL >= 3 / PROJ >= 6 is significantly different from earlier versions. In particular +datum will only encode WGS84, NAD27 and NAD83, and +towgs84/+nadgrids terms will be missing most of the time. PROJ strings to encode CRS should be considered as a a legacy solution. Using a AUTHORITY:CODE or WKT representation is the recommended way.

    Parameters:

      ppszProj4 -- pointer to which dynamically allocated PROJ definition will be assigned.

    Returns:

      OGRERR_NONE on success or an error code on failure.

  OGRErr exportToPCI(char**, char**, double**) const

    Export coordinate system in PCI projection definition.

    Converts the loaded coordinate reference system into PCI projection definition to the extent possible. The strings returned in ppszProj, ppszUnits and ppadfPrjParams array should be deallocated by the caller with CPLFree() when no longer needed.

    LOCAL_CS coordinate systems are not translatable. An empty string will be returned along with OGRERR_NONE.

    This method is the equivalent of the C function OSRExportToPCI().

    Parameters:

      - ppszProj -- pointer to which dynamically allocated PCI projection definition will be assigned.

      - ppszUnits -- pointer to which dynamically allocated units definition will be assigned.

      - ppadfPrjParams -- pointer to which dynamically allocated array of 17 projection parameters will be assigned. See importFromPCI() for the list of parameters.

    Returns:

      OGRERR_NONE on success or an error code on failure.

  OGRErr exportToUSGS(long*, long*, double**, long*) const

    Export coordinate system in USGS GCTP projection definition.

    This method is the equivalent of the C function OSRExportToUSGS().

    Parameters:

      - piProjSys -- Pointer to variable, where the projection system code will be returned.

      - piZone -- Pointer to variable, where the zone for UTM and State Plane projection systems will be returned.

      - ppadfPrjParams -- Pointer to which dynamically allocated array of 15 projection parameters will be assigned. See importFromUSGS() for the list of parameters. Caller responsible to free this array.

      - piDatum -- Pointer to variable, where the datum code will be returned.

    Returns:

      OGRERR_NONE on success or an error code on failure.

  OGRErr exportToXML(char**, const char* = nullptr) const

    Export coordinate system in XML format.

    Converts the loaded coordinate reference system into XML format to the extent possible. The string returned in ppszRawXML should be deallocated by the caller with CPLFree() when no longer needed.

    LOCAL_CS coordinate systems are not translatable. An empty string will be returned along with OGRERR_NONE.

    This method is the equivalent of the C function OSRExportToXML().

    Parameters:

      - ppszRawXML -- pointer to which dynamically allocated XML definition will be assigned.

      - pszDialect -- currently ignored. The dialect used is GML based.

    Returns:

      OGRERR_NONE on success or an error code on failure.

  OGRErr exportToPanorama(long*, long*, long*, long*, double*) const

    Export coordinate system in "Panorama" GIS projection definition.

    This method is the equivalent of the C function OSRExportToPanorama().

    Parameters:

      - piProjSys -- Pointer to variable, where the projection system code will be returned.

      - piDatum -- Pointer to variable, where the coordinate system code will be returned.

      - piEllips -- Pointer to variable, where the spheroid code will be returned.

      - piZone -- Pointer to variable, where the zone for UTM projection system will be returned.

      - padfPrjParams -- an existing 7 double buffer into which the projection parameters will be placed. See importFromPanorama() for the list of parameters.

    Returns:

      OGRERR_NONE on success or an error code on failure.

  OGRErr exportVertCSToPanorama(int*) const

    Export vertical coordinate system to "Panorama" GIS projection definition.

  OGRErr exportToERM(char *pszProj, char *pszDatum, char *pszUnits)

    Convert coordinate system to ERMapper format.

    Parameters:

      - pszProj -- 32 character buffer to receive projection name.

      - pszDatum -- 32 character buffer to receive datum name.

      - pszUnits -- 32 character buffer to receive units name.

    Returns:

      OGRERR_NONE on success, OGRERR_SRS_UNSUPPORTED if not translation is found, or OGRERR_FAILURE on other failures.

  OGRErr exportToMICoordSys(char**) const

    Export coordinate system in Mapinfo style CoordSys format.

    Note that the returned WKT string should be freed with CPLFree() when no longer needed. It is the responsibility of the caller.

    This method is the same as the C function OSRExportToMICoordSys().

    Parameters:

      ppszResult -- pointer to which dynamically allocated Mapinfo CoordSys definition will be assigned.

    Returns:

      OGRERR_NONE on success, OGRERR_FAILURE on failure, OGRERR_UNSUPPORTED_OPERATION if MITAB library was not linked in.

  OGRErr exportToCF1(char **ppszGridMappingName, char ***ppapszKeyValues, char **ppszUnits, CSLConstList papszOptions) const

    Export a CRS to netCDF CF-1 definitions.

    http://cfconventions.org/cf-conventions/cf-conventions.html#appendix-grid-mappings

    This function is the equivalent of the C function OSRExportToCF1().

    Since

      3.9

    Parameters:

      - ppszGridMappingName -- [out] Pointer to the suggested name for the grid mapping variable. ppszGridMappingName may be nullptr. *ppszGridMappingName should be freed with CPLFree().

      - ppapszKeyValues -- [out] Pointer to a null-terminated list of key/value pairs, to write into the grid mapping variable. ppapszKeyValues may be nullptr. *ppapszKeyValues should be freed with CSLDestroy() Values may be of type string, double or a list of 2 double values (comma separated).

      - ppszUnits -- [out] Pointer to the value of the "units" attribute of the X/Y arrays. ppszGridMappingName may be nullptr. *ppszUnits should be freed with CPLFree().

      - papszOptions -- [in] Options. Currently none supported

    Returns:

      OGRERR_NONE on success or an error code in case of failure.

  OGRErr importFromWkt(char**)

    Import from WKT string.

    This method will wipe the existing SRS definition, and reassign it based on the contents of the passed WKT string. Only as much of the input string as needed to construct this SRS is consumed from the input string, and the input string pointer is then updated to point to the remaining (unused) input.

    Consult also the OGC WKT Coordinate System Issues page for implementation details of WKT in OGR.

    This method is the same as the C function OSRImportFromWkt().

    Deprecated:

      Use importFromWkt(const char**) or importFromWkt(constchar*)

    Parameters:

      ppszInput -- Pointer to pointer to input. The pointer is updated to point to remaining unused input text.

    Returns:

      OGRERR_NONE if import succeeds, or OGRERR_CORRUPT_DATA if it fails for any reason.

  OGRErr importFromWkt(const char**)

    Import from WKT string.

    This method will wipe the existing SRS definition, and reassign it based on the contents of the passed WKT string. Only as much of the input string as needed to construct this SRS is consumed from the input string, and the input string pointer is then updated to point to the remaining (unused) input.

    Starting with PROJ 9.2, if invoked on a COORDINATEMETADATA[] construct, the CRS contained in it will be used to fill the OGRSpatialReference object, and the coordinate epoch potentially present used as the coordinate epoch property of the OGRSpatialReference object.

    Consult also the OGC WKT Coordinate System Issues page for implementation details of WKT in OGR.

    This method is the same as the C function OSRImportFromWkt().

    Parameters:

      ppszInput -- Pointer to pointer to input. The pointer is updated to point to remaining unused input text.

    Returns:

      OGRERR_NONE if import succeeds, or OGRERR_CORRUPT_DATA if it fails for any reason.

  OGRErr importFromWkt(const char*)

    Import from WKT string.

    This method will wipe the existing SRS definition, and reassign it based on the contents of the passed WKT string. Only as much of the input string as needed to construct this SRS is consumed from the input string, and the input string pointer is then updated to point to the remaining (unused) input.

    Consult also the OGC WKT Coordinate System Issues page for implementation details of WKT in OGR.

    Parameters:

      pszInput -- Input WKT

    Returns:

      OGRERR_NONE if import succeeds, or OGRERR_CORRUPT_DATA if it fails for any reason.

  OGRErr importFromProj4(const char*)

    Import PROJ coordinate string.

    The OGRSpatialReference is initialized from the passed PROJs style coordinate system string.

    Example: pszProj4 = "+proj=utm +zone=11 +datum=WGS84"

    It is also possible to import "+init=epsg:n" style definitions. Those are a legacy syntax that should be avoided in the future. In particular they will result in CRS objects whose axis order might not correspond to the official EPSG axis order.

    This method is the equivalent of the C function OSRImportFromProj4().

    Parameters:

      pszProj4 -- the PROJ style string.

    Returns:

      OGRERR_NONE on success or OGRERR_CORRUPT_DATA on failure.

  OGRErr importFromEPSG(int)

    Initialize SRS based on EPSG geographic, projected or vertical CRS code.

    This method will initialize the spatial reference based on the passed in EPSG CRS code found in the PROJ database.

    This method is the same as the C function OSRImportFromEPSG().

    Before GDAL 3.0.3, this method would try to attach a 3-parameter or 7-parameter Helmert transformation to WGS84 when there is one and only one such method available for the CRS. This behavior might not always be desirable, so starting with GDAL 3.0.3, this is no longer done unless the OSR_ADD_TOWGS84_ON_IMPORT_FROM_EPSG configuration option is set to YES.

    Parameters:

      nCode -- a GCS or PCS code from the horizontal coordinate system table.

    Returns:

      OGRERR_NONE on success, or an error code on failure.

  OGRErr importFromEPSGA(int)

    Initialize SRS based on EPSG geographic, projected or vertical CRS code.

    This method will initialize the spatial reference based on the passed in EPSG CRS code found in the PROJ database.

    Since GDAL 3.0, this method is identical to importFromEPSG().

    Before GDAL 3.0.3, this method would try to attach a 3-parameter or 7-parameter Helmert transformation to WGS84 when there is one and only one such method available for the CRS. This behavior might not always be desirable, so starting with GDAL 3.0.3, this is no longer done unless the OSR_ADD_TOWGS84_ON_IMPORT_FROM_EPSG configuration option is set to YES. The AddGuessedTOWGS84() method can also be used for that purpose.

    The method will also by default substitute a deprecated EPSG code by its non-deprecated replacement. If this behavior is not desired, the OSR_USE_NON_DEPRECATED configuration option can be set to NO.

    This method is the same as the C function OSRImportFromEPSGA().

    Parameters:

      nCode -- a CRS code.

    Returns:

      OGRERR_NONE on success, or an error code on failure.

  OGRErr importFromESRI(char**)

    Import coordinate system from ESRI .prj format(s).

    This function will read the text loaded from an ESRI .prj file, and translate it into an OGRSpatialReference definition. This should support many (but by no means all) old style (Arc/Info 7.x) .prj files, as well as the newer pseudo-OGC WKT .prj files. Note that new style .prj files are in OGC WKT format, but require some manipulation to correct datum names, and units on some projection parameters. This is addressed within importFromESRI() by an automatic call to morphFromESRI().

    Currently only GEOGRAPHIC, UTM, STATEPLANE, GREATBRITIAN_GRID, ALBERS, EQUIDISTANT_CONIC, TRANSVERSE (mercator), POLAR, LAMBERT (Conic Conformal), LAMBERT_AZIMUTHAL, MERCATOR and POLYCONIC projections are supported from old style files.

    At this time there is no equivalent exportToESRI() method. Writing old style .prj files is not supported by OGRSpatialReference. However the morphToESRI() and exportToWkt() methods can be used to generate output suitable to write to new style (Arc 8) .prj files.

    This function is the equivalent of the C function OSRImportFromESRI().

    Parameters:

      papszPrj -- NULL terminated list of strings containing the definition.

    Returns:

      OGRERR_NONE on success or an error code in case of failure.

  OGRErr importFromPCI(const char*, const char* = nullptr, const double* = nullptr)

    Import coordinate system from PCI projection definition.

    PCI software uses 16-character string to specify coordinate system and datum/ellipsoid. You should supply at least this string to the importFromPCI() function.

    This function is the equivalent of the C function OSRImportFromPCI().

    [0] Spheroid semi major axis [1] Spheroid semi minor axis [2] Reference Longitude [3] Reference Latitude [4] First Standard Parallel [5] Second Standard Parallel [6] False Easting [7] False Northing [8] Scale Factor [9] Height above sphere surface [10] Longitude of 1st point on center line [11] Latitude of 1st point on center line [12] Longitude of 2nd point on center line [13] Latitude of 2nd point on center line [14] Azimuth east of north for center line [15] Landsat satellite number [16] Landsat path number

    Particular projection uses different parameters, unused ones may be set to zero. If NULL is supplied instead of an array pointer, default values will be used (i.e., zeroes).

    Parameters:

      - pszProj -- NULL terminated string containing the definition. Looks like "pppppppppppp Ennn" or "pppppppppppp Dnnn", where "pppppppppppp" is a projection code, "Ennn" is an ellipsoid code, "Dnnn" a datum code.

      - pszUnits -- Grid units code ("DEGREE" or "METRE"). If NULL "METRE" will be used.

      - padfPrjParams -- Array of 17 coordinate system parameters:

    Returns:

      OGRERR_NONE on success or an error code in case of failure.

  OGRErr importFromUSGS(long iProjSys, long iZone, double *padfPrjParams, long iDatum, int nUSGSAngleFormat = USGS_ANGLE_PACKEDDMS)

    Import coordinate system from USGS projection definition.

    This method will import projection definition in style, used by USGS GCTP software. GCTP operates on angles in packed DMS format (see CPLDecToPackedDMS() function for details), so all angle values (latitudes, longitudes, azimuths, etc.) specified in the padfPrjParams array should be in the packed DMS format, unless bAnglesInPackedDMSFormat is set to FALSE.

    This function is the equivalent of the C function OSRImportFromUSGS(). Note that the bAnglesInPackedDMSFormat parameter is only present in the C++ method. The C function assumes bAnglesInPackedFormat = TRUE.

        Projection Transformation Package Projection Parameters:

        ----------------------------------------------------------------------------
                                |                    Array Element
         Code & Projection Id   |---------------------------------------------------
                                |   0  |   1  |  2   |  3   |   4   |    5    |6 | 7
        ----------------------------------------------------------------------------
         0 Geographic           |      |      |      |      |       |         |  |
         1 U T M                |Lon/Z |Lat/Z |      |      |       |         |  |
         2 State Plane          |      |      |      |      |       |         |  |
         3 Albers Equal Area    |SMajor|SMinor|STDPR1|STDPR2|CentMer|OriginLat|FE|FN
         4 Lambert Conformal C  |SMajor|SMinor|STDPR1|STDPR2|CentMer|OriginLat|FE|FN
         5 Mercator             |SMajor|SMinor|      |      |CentMer|TrueScale|FE|FN
         6 Polar Stereographic  |SMajor|SMinor|      |      |LongPol|TrueScale|FE|FN
         7 Polyconic            |SMajor|SMinor|      |      |CentMer|OriginLat|FE|FN
         8 Equid. Conic A       |SMajor|SMinor|STDPAR|      |CentMer|OriginLat|FE|FN
           Equid. Conic B       |SMajor|SMinor|STDPR1|STDPR2|CentMer|OriginLat|FE|FN
         9 Transverse Mercator  |SMajor|SMinor|Factor|      |CentMer|OriginLat|FE|FN
        10 Stereographic        |Sphere|      |      |      |CentLon|CenterLat|FE|FN
        11 Lambert Azimuthal    |Sphere|      |      |      |CentLon|CenterLat|FE|FN
        12 Azimuthal            |Sphere|      |      |      |CentLon|CenterLat|FE|FN
        13 Gnomonic             |Sphere|      |      |      |CentLon|CenterLat|FE|FN
        14 Orthographic         |Sphere|      |      |      |CentLon|CenterLat|FE|FN
        15 Gen. Vert. Near Per  |Sphere|      |Height|      |CentLon|CenterLat|FE|FN
        16 Sinusoidal           |Sphere|      |      |      |CentMer|         |FE|FN
        17 Equirectangular      |Sphere|      |      |      |CentMer|TrueScale|FE|FN
        18 Miller Cylindrical   |Sphere|      |      |      |CentMer|         |FE|FN
        19 Van der Grinten      |Sphere|      |      |      |CentMer|OriginLat|FE|FN
        20 Hotin Oblique Merc A |SMajor|SMinor|Factor|      |       |OriginLat|FE|FN
           Hotin Oblique Merc B |SMajor|SMinor|Factor|AziAng|AzmthPt|OriginLat|FE|FN
        21 Robinson             |Sphere|      |      |      |CentMer|         |FE|FN
        22 Space Oblique Merc A |SMajor|SMinor|      |IncAng|AscLong|         |FE|FN
           Space Oblique Merc B |SMajor|SMinor|Satnum|Path  |       |         |FE|FN
        23 Alaska Conformal     |SMajor|SMinor|      |      |       |         |FE|FN
        24 Interrupted Goode    |Sphere|      |      |      |       |         |  |
        25 Mollweide            |Sphere|      |      |      |CentMer|         |FE|FN
        26 Interrupt Mollweide  |Sphere|      |      |      |       |         |  |
        27 Hammer               |Sphere|      |      |      |CentMer|         |FE|FN
        28 Wagner IV            |Sphere|      |      |      |CentMer|         |FE|FN
        29 Wagner VII           |Sphere|      |      |      |CentMer|         |FE|FN
        30 Oblated Equal Area   |Sphere|      |Shapem|Shapen|CentLon|CenterLat|FE|FN
        ----------------------------------------------------------------------------

              ----------------------------------------------------
                                      |      Array Element       |
                Code & Projection Id  |---------------------------
                                      |  8  |  9 |  10 | 11 | 12 |
              ----------------------------------------------------
               0 Geographic           |     |    |     |    |    |
               1 U T M                |     |    |     |    |    |
               2 State Plane          |     |    |     |    |    |
               3 Albers Equal Area    |     |    |     |    |    |
               4 Lambert Conformal C  |     |    |     |    |    |
               5 Mercator             |     |    |     |    |    |
               6 Polar Stereographic  |     |    |     |    |    |
               7 Polyconic            |     |    |     |    |    |
               8 Equid. Conic A       |zero |    |     |    |    |
                 Equid. Conic B       |one  |    |     |    |    |
               9 Transverse Mercator  |     |    |     |    |    |
              10 Stereographic        |     |    |     |    |    |
              11 Lambert Azimuthal    |     |    |     |    |    |
              12 Azimuthal            |     |    |     |    |    |
              13 Gnomonic             |     |    |     |    |    |
              14 Orthographic         |     |    |     |    |    |
              15 Gen. Vert. Near Per  |     |    |     |    |    |
              16 Sinusoidal           |     |    |     |    |    |
              17 Equirectangular      |     |    |     |    |    |
              18 Miller Cylindrical   |     |    |     |    |    |
              19 Van der Grinten      |     |    |     |    |    |
              20 Hotin Oblique Merc A |Long1|Lat1|Long2|Lat2|zero|
                 Hotin Oblique Merc B |     |    |     |    |one |
              21 Robinson             |     |    |     |    |    |
              22 Space Oblique Merc A |PSRev|LRat|PFlag|    |zero|
                 Space Oblique Merc B |     |    |     |    |one |
              23 Alaska Conformal     |     |    |     |    |    |
              24 Interrupted Goode    |     |    |     |    |    |
              25 Mollweide            |     |    |     |    |    |
              26 Interrupt Mollweide  |     |    |     |    |    |
              27 Hammer               |     |    |     |    |    |
              28 Wagner IV            |     |    |     |    |    |
              29 Wagner VII           |     |    |     |    |    |
              30 Oblated Equal Area   |Angle|    |     |    |    |
              ----------------------------------------------------

          where

           Lon/Z     Longitude of any point in the UTM zone or zero.  If zero,
                     a zone code must be specified.
           Lat/Z     Latitude of any point in the UTM zone or zero.  If zero, a
                     zone code must be specified.
           SMajor    Semi-major axis of ellipsoid.  If zero, Clarke 1866 in meters
                     is assumed.
           SMinor    Eccentricity squared of the ellipsoid if less than zero,
                     if zero, a spherical form is assumed, or if greater than
                     zero, the semi-minor axis of ellipsoid.
           Sphere    Radius of reference sphere.  If zero, 6370997 meters is used.
           STDPAR    Latitude of the standard parallel
           STDPR1    Latitude of the first standard parallel
           STDPR2    Latitude of the second standard parallel
           CentMer   Longitude of the central meridian
           OriginLat Latitude of the projection origin
           FE        False easting in the same units as the semi-major axis
           FN        False northing in the same units as the semi-major axis
           TrueScale Latitude of true scale
           LongPol   Longitude down below pole of map
           Factor    Scale factor at central meridian (Transverse Mercator) or
                     center of projection (Hotine Oblique Mercator)
           CentLon   Longitude of center of projection
           CenterLat Latitude of center of projection
           Height    Height of perspective point
           Long1     Longitude of first point on center line (Hotine Oblique
                     Mercator, format A)
           Long2     Longitude of second point on center line (Hotine Oblique
                     Mercator, format A)
           Lat1      Latitude of first point on center line (Hotine Oblique
                     Mercator, format A)
           Lat2      Latitude of second point on center line (Hotine Oblique
                     Mercator, format A)
           AziAng    Azimuth angle east of north of center line (Hotine Oblique
                     Mercator, format B)
           AzmthPt   Longitude of point on central meridian where azimuth occurs
                     (Hotine Oblique Mercator, format B)
           IncAng    Inclination of orbit at ascending node, counter-clockwise
                     from equator (SOM, format A)
           AscLong   Longitude of ascending orbit at equator (SOM, format A)
           PSRev     Period of satellite revolution in minutes (SOM, format A)
           LRat      Landsat ratio to compensate for confusion at northern end
                     of orbit (SOM, format A -- use 0.5201613)
           PFlag     End of path flag for Landsat:  0 = start of path,
                     1 = end of path (SOM, format A)
           Satnum    Landsat Satellite Number (SOM, format B)
           Path      Landsat Path Number (Use WRS-1 for Landsat 1, 2 and 3 and
                     WRS-2 for Landsat 4, 5 and 6.)  (SOM, format B)
           Shapem    Oblated Equal Area oval shape parameter m
           Shapen    Oblated Equal Area oval shape parameter n
           Angle     Oblated Equal Area oval rotation angle

        Array elements 13 and 14 are set to zero. All array elements with blank
        fields are set to zero too.

    If the datum code is negative, the first two values in the parameter array (param) are used to define the values as follows:

    - If padfPrjParams[0] is a non-zero value and padfPrjParams[1] is greater than one, the semimajor axis is set to padfPrjParams[0] and the semiminor axis is set to padfPrjParams[1].

    - If padfPrjParams[0] is nonzero and padfPrjParams[1] is greater than zero but less than or equal to one, the semimajor axis is set to padfPrjParams[0] and the semiminor axis is computed from the eccentricity squared value padfPrjParams[1]:

      semiminor = sqrt(1.0 - ES)semimajor

      where

      ES = eccentricity squared

    - If padfPrjParams[0] is nonzero and padfPrjParams[1] is equal to zero, the semimajor axis and semiminor axis are set to padfPrjParams[0].

    - If padfPrjParams[0] equals zero and padfPrjParams[1] is greater than zero, the default Clarke 1866 is used to assign values to the semimajor axis and semiminor axis.

    - If padfPrjParams[0] and padfPrjParams[1] equals zero, the semimajor axis is set to 6370997.0 and the semiminor axis is set to zero.

    If a datum code is zero or greater, the semimajor and semiminor axis are defined by the datum code as found in the following table:

    Supported Datums are:

    - 0: Clarke 1866 (default)

    - 1: Clarke 1880

    - 2: Bessel

    - 3: International 1967

    - 4: International 1909

    - 5: WGS 72

    - 6: Everest

    - 7: WGS 66

    - 8: GRS 1980/WGS 84

    - 9: Airy

    - 10: Modified Everest

    - 11: Modified Airy

    - 12: WGS 84

    - 13: Southeast Asia

    - 14: Australian National

    - 15: Krassovsky

    - 16: Hough

    - 17: Mercury 1960

    - 18: Modified Mercury 1968

    - 19: Sphere of Radius 6370997 meters

    Parameters:

      - iProjSys -- Input projection system code, used in GCTP.

      - iZone -- Input zone for UTM and State Plane projection systems. For Southern Hemisphere UTM use a negative zone code. iZone ignored for all other projections.

      - padfPrjParams -- Array of 15 coordinate system parameters. These parameters differs for different projections.

      - iDatum -- Input spheroid.

      - nUSGSAngleFormat -- one of USGS_ANGLE_DECIMALDEGREES, USGS_ANGLE_PACKEDDMS, or USGS_ANGLE_RADIANS (default is USGS_ANGLE_PACKEDDMS).

    Returns:

      OGRERR_NONE on success or an error code in case of failure.

  OGRErr importFromPanorama(long, long, long, double*, bool bNorth = true)

    Import coordinate system from "Panorama" GIS projection definition.

    This method will import projection definition in style, used by "Panorama" GIS.

    This function is the equivalent of the C function OSRImportFromPanorama().

    Supported Projections are:

    - 1: Gauss-Kruger (Transverse Mercator)

    - 2: Lambert Conformal Conic 2SP

    - 5: Stereographic

    - 6: Azimuthal Equidistant (Postel)

    - 8: Mercator

    - 10: Polyconic

    - 13: Polar Stereographic

    - 15: Gnomonic

    - 17: Universal Transverse Mercator (UTM)

    - 18: Wagner I (Kavraisky VI)

    - 19: Mollweide

    - 20: Equidistant Conic

    - 24: Lambert Azimuthal Equal Area

    - 27: Equirectangular

    - 28: Cylindrical Equal Area (Lambert)

    - 29: International Map of the World Polyconic

    Supported Datums are:

    - 1: Pulkovo, 1942

    - 2: WGS, 1984

    - 3: OSGB 1936 (British National Grid)

    - 9: Pulkovo, 1995

    - 10: GSK 2011

    Supported Spheroids are:

    - 1: Krassovsky, 1940

    - 2: WGS, 1972

    - 3: International, 1924 (Hayford, 1909)

    - 4: Clarke, 1880

    - 5: Clarke, 1866 (NAD1927)

    - 6: Everest, 1830

    - 7: Bessel, 1841

    - 8: Airy, 1830

    - 9: WGS, 1984 (GPS)

    - 10: PZ-90.02

    - 11: GRS, 1980 (NAD1983)

    - 12: IERS 1996 (6378136.49 298.25645)

    - 13: International, 1924 (Hayford, 1909)

    - 14: South American, 1969

    - 15: Indonesian, 1974

    - 16: Helmert 1906

    - 17: Fisher 1960

    - 18: Fisher 1968

    - 19. Haff 1960 - (6378270.0 297.0)

    - 20: Everest, 1830

    - 21: Australian National, 1965

    - 22: CGCS2000

    - 23: Airy Modified 1849

    - 24: Bessel Modified

    - 25: Bessel Namibia

    - 26: Bessel Namibia (GLM)

    - 27: Clarke 1880 (Arc)

    - 28: Clarke 1880 (SGA 1922)

    - 29: Everest (1830 Definition)

    - 30: Everest 1830 Modified

    - 31: Everest 1830 (RSO 1969)

    - 32: Everest 1830 (1975 Definition)

    - 33: NWL 9D

    - 34: Plessis 1817

    - 35: Struve 1860

    - 36: War Office

    - 37: GEM 10C

    - 38: OSU86F

    - 39: OSU91A

    - 40: GRS 1967

    - 41: Average Terrestrial System 1977

    - 42: IAG 1975

    - 43: GRS 1967 Modified

    - 44: Danish 1876

    - 45: GRS 1980 Authalic Sphere

    - 46: GSK 2011

    - 47: PZ-90

    - [0] Latitude of the first standard parallel (radians)

    - [1] Latitude of the second standard parallel (radians)

    - [2] Latitude of center of projection (radians)

    - [3] Longitude of center of projection (radians)

    - [4] Scaling factor

    - [5] False Easting

    - [6] False Northing

    - [7] Zone number

    Particular projection uses different parameters, unused ones may be set to zero. If NULL supplied instead of array pointer default values will be used (i.e., zeroes).

    Parameters:

      - iProjSys -- Input projection system code, used in GIS "Panorama".

      - iDatum -- Input coordinate system.

      - iEllips -- Input spheroid.

      - padfPrjParams -- Array of 8 coordinate system parameters:

      - bNorth -- If northern hemisphere true, else false. Defaults to true.

    Returns:

      OGRERR_NONE on success or an error code in case of failure.

  OGRErr importVertCSFromPanorama(int)

    Import vertical coordinate system from "Panorama" GIS projection definition.

    Supported VCS are:

    - 1: Baltic 1977 height (EPSG:5705)

    - 2: AHD height (EPSG:5711)

    - 4: Ostend height (EPSG:5710)

    - 5: Ostend height (EPSG:5710)

    - 7: Belfast height (EPSG: 5732)

    - 8: Malin Head height (EPSG: 5731)

    - 10: Piraeus height (EPSG:5716)

    - 11: DNN height (EPSG:5733)

    - 12: ISH2004 height (EPSG:8089)

    - 13: Alicante height (EPSG:5782)

    - 15: Genoa height (EPSG:5214)

    - 16: NAP height (EPSG:5709)

    - 17: NN54 height (EPSG:5776)

    - 19: Cascais height (EPSG:5780)

    - 20: N60 height (EPSG:5717)

    - 21: RH2000 height (EPSG:5613)

    - 23: Antalya height (EPSG:5775)

    - 24: NGVD29 height (ftUS) (EPSG:5702)

    - 25: Baltic 1977 height (EPSG:5705)

    - 27: MSL height (EPSG:5714)

    Parameters:

      iVCS -- Input vertical coordinate system ID.

  OGRErr importFromOzi(const char *const *papszLines)

    Import coordinate system from OziExplorer projection definition.

    This method will import projection definition in style, used by OziExplorer software.

    Parameters:

      papszLines -- Map file lines. This is an array of strings containing the whole OziExplorer .MAP file. The array is terminated by a NULL pointer.

    Returns:

      OGRERR_NONE on success or an error code in case of failure.

  OGRErr importFromWMSAUTO(const char *pszAutoDef)

    Initialize from WMSAUTO string.

    Note that the WMS 1.3 specification does not include the units code, while apparently earlier specs do. We try to guess around this.

    Parameters:

      pszDefinition -- the WMSAUTO string

    Returns:

      OGRERR_NONE on success or an error code.

  OGRErr importFromXML(const char*)

    Import coordinate system from XML format (GML only currently).

    This method is the same as the C function OSRImportFromXML()

    Parameters:

      pszXML -- XML string to import

    Returns:

      OGRERR_NONE on success or OGRERR_CORRUPT_DATA on failure.

  OGRErr importFromDict(const char *pszDict, const char *pszCode)

    Read SRS from WKT dictionary.

    This method will attempt to find the indicated coordinate system identity in the indicated dictionary file. If found, the WKT representation is imported and used to initialize this OGRSpatialReference.

    More complete information on the format of the dictionary files can be found in the epsg.wkt file in the GDAL data tree. The dictionary files are searched for in the "GDAL" domain using CPLFindFile(). Normally this results in searching /usr/local/share/gdal or somewhere similar.

    This method is the same as the C function OSRImportFromDict().

    Parameters:

      - pszDictFile -- the name of the dictionary file to load.

      - pszCode -- the code to lookup in the dictionary.

    Returns:

      OGRERR_NONE on success, or OGRERR_SRS_UNSUPPORTED if the code isn't found, and OGRERR_SRS_FAILURE if something more dramatic goes wrong.

  OGRErr importFromURN(const char*)

    Initialize from OGC URN.

    Initializes this spatial reference from a coordinate system defined by an OGC URN prefixed with "urn:ogc:def:crs:" per recommendation paper 06-023r1. Currently EPSG and OGC authority values are supported, including OGC auto codes, but not including CRS1 or CRS88 (NAVD88).

    This method is also support through SetFromUserInput() which can normally be used for URNs.

    Parameters:

      pszURN -- the urn string.

    Returns:

      OGRERR_NONE on success or an error code.

  OGRErr importFromCRSURL(const char*)

    Initialize from OGC URL.

    Initializes this spatial reference from a coordinate system defined by an OGC URL prefixed with "http://opengis.net/def/crs" per best practice paper 11-135. Currently EPSG and OGC authority values are supported, including OGC auto codes, but not including CRS1 or CRS88 (NAVD88).

    This method is also supported through SetFromUserInput() which can normally be used for URLs.

    Parameters:

      pszURL -- the URL string.

    Returns:

      OGRERR_NONE on success or an error code.

  OGRErr importFromERM(const char *pszProj, const char *pszDatum, const char *pszUnits)

    Create OGR WKT from ERMapper projection definitions.

    Generates an OGRSpatialReference definition from an ERMapper datum and projection name. Based on the ecw_cs.wkt dictionary file from gdal/data.

    Parameters:

      - pszProj -- the projection name, such as "NUTM11" or "GEOGRAPHIC".

      - pszDatum -- the datum name, such as "NAD83".

      - pszUnits -- the linear units "FEET" or "METERS".

    Returns:

      OGRERR_NONE on success or OGRERR_UNSUPPORTED_SRS if not found.

  OGRErr importFromUrl(const char*)

    Set spatial reference from a URL.

    This method will download the spatial reference at a given URL and feed it into SetFromUserInput for you.

    This method does the same thing as the OSRImportFromUrl() function.

    Parameters:

      pszUrl -- text definition to try to deduce SRS from.

    Returns:

      OGRERR_NONE on success, or an error code with the curl error message if it is unable to download data.

  OGRErr importFromMICoordSys(const char*)

    Import Mapinfo style CoordSys definition.

    The OGRSpatialReference is initialized from the passed Mapinfo style CoordSys definition string.

    This method is the equivalent of the C function OSRImportFromMICoordSys().

    Parameters:

      pszCoordSys -- Mapinfo style CoordSys definition string.

    Returns:

      OGRERR_NONE on success, OGRERR_FAILURE on failure, OGRERR_UNSUPPORTED_OPERATION if MITAB library was not linked in.

  OGRErr importFromCF1(CSLConstList papszKeyValues, const char *pszUnits)

    Import a CRS from netCDF CF-1 definitions.

    http://cfconventions.org/cf-conventions/cf-conventions.html#appendix-grid-mappings

    This function is the equivalent of the C function OSRImportFromCF1().

    Since

      3.9

    Parameters:

      - papszKeyValues -- Key/value pairs from the grid mapping variable. Multi-valued parameters (typically "standard_parallel") should be comma separated.

      - pszUnits -- Value of the "units" attribute of the X/Y arrays. May be nullptr

    Returns:

      OGRERR_NONE on success or an error code in case of failure.

  OGRErr morphToESRI()

    Convert in place to ESRI WKT format.

    The value nodes of this coordinate system are modified in various manners more closely map onto the ESRI concept of WKT format. This includes renaming a variety of projections and arguments, and stripping out nodes note recognised by ESRI (like AUTHORITY and AXIS).

    This does the same as the C function OSRMorphToESRI().

    Deprecated:

    Note

    Since GDAL 3.0, this function has only user-visible effects at exportToWkt()

    time. It is recommended to use instead exportToWkt(char**,

    const char* const char*) const with options having FORMAT=WKT1_ESRI.

    Returns:

      OGRERR_NONE unless something goes badly wrong.

  OGRErr morphFromESRI()

    Convert in place from ESRI WKT format.

    The value notes of this coordinate system are modified in various manners to adhere more closely to the WKT standard. This mostly involves translating a variety of ESRI names for projections, arguments and datums to "standard" names, as defined by Adam Gawne-Cain's reference translation of EPSG to WKT for the CT specification.

    This does the same as the C function OSRMorphFromESRI().

    Deprecated:

    Note

    Since GDAL 3.0, this function is essentially a no-operation, since morphing from ESRI is automatically done by importFromWkt(). Its only effect is to undo the effect of a potential prior call to morphToESRI().

    Returns:

      OGRERR_NONE unless something goes badly wrong.

  OGRSpatialReference *convertToOtherProjection(const char *pszTargetProjection, const char *const *papszOptions = nullptr) const

    Convert to another equivalent projection.

    Currently implemented:

    - SRS_PT_MERCATOR_1SP to SRS_PT_MERCATOR_2SP

    - SRS_PT_MERCATOR_2SP to SRS_PT_MERCATOR_1SP

    - SRS_PT_LAMBERT_CONFORMAL_CONIC_1SP to SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP

    - SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP to SRS_PT_LAMBERT_CONFORMAL_CONIC_1SP

    Parameters:

      - pszTargetProjection -- target projection.

      - papszOptions -- lists of options. None supported currently.

    Returns:

      a new SRS, or NULL in case of error.

  OGRErr Validate() const

    Validate CRS imported with importFromWkt() or with modified with direct node manipulations.

    Otherwise the CRS should be always valid.

    This method attempts to verify that the spatial reference system is well formed, and consists of known tokens. The validation is not comprehensive.

    This method is the same as the C function OSRValidate().

    Returns:

      OGRERR_NONE if all is fine, OGRERR_CORRUPT_DATA if the SRS is not well formed, and OGRERR_UNSUPPORTED_SRS if the SRS is well formed, but contains non-standard PROJECTION[] values.

  OGRErr StripVertical()

    Convert a compound cs into a horizontal CS.

    If this SRS is of type COMPD_CS[] then the vertical CS and the root COMPD_CS nodes are stripped resulting and only the horizontal coordinate system portion remains (normally PROJCS, GEOGCS or LOCAL_CS).

    If this is not a compound coordinate system then nothing is changed.

    This method is the same as the C function OSRStripVertical().

  bool StripTOWGS84IfKnownDatumAndAllowed()

    Remove TOWGS84 information if the CRS has a known horizontal datum and this is allowed by the user.

    The default behavior is to remove TOWGS84 information if the CRS has a known horizontal datum. This can be disabled by setting the OSR_STRIP_TOWGS84 configuration option to NO.

    Since

      OGR 3.1.0

    Returns:

      true if TOWGS84 has been removed.

  bool StripTOWGS84IfKnownDatum()

    Remove TOWGS84 information if the CRS has a known horizontal datum.

    Since

      OGR 3.1.0

    Returns:

      true if TOWGS84 has been removed.

  int EPSGTreatsAsLatLong() const

    This method returns TRUE if this geographic coordinate system should be treated as having lat/long coordinate ordering.

    Currently this returns TRUE for all geographic coordinate systems with axes set defining it as lat, long (prior to GDAL 3.10, it also checked that the CRS had belonged to EPSG authority, but this check has now been removed).

    FALSE will be returned for all coordinate systems that are not geographic, or whose axes ordering is not latitude, longitude.

    This method is the same as the C function OSREPSGTreatsAsLatLong().

    Note

    Important change of behavior since GDAL 3.0. In previous versions, geographic CRS imported with importFromEPSG() would cause this method to return FALSE on them, whereas now it returns TRUE, since importFromEPSG() is now equivalent to importFromEPSGA().

    Returns:

      TRUE or FALSE.

  int EPSGTreatsAsNorthingEasting() const

    This method returns TRUE if this projected coordinate system should be treated as having northing/easting coordinate ordering.

    Currently this returns TRUE for all projected coordinate systems with axes set defining it as northing, easting (prior to GDAL 3.10, it also checked that the CRS had belonged to EPSG authority, but this check has now been removed).

    FALSE will be returned for all coordinate systems that are not projected, or whose axes ordering is not northing, easting.

    This method is the same as the C function EPSGTreatsAsNorthingEasting().

    Note

    Important change of behavior since GDAL 3.0. In previous versions, projected CRS with northing, easting axis order imported with importFromEPSG() would cause this method to return FALSE on them, whereas now it returns TRUE, since importFromEPSG() is now equivalent to importFromEPSGA().

    Returns:

      TRUE or FALSE.

  int GetAxesCount() const

    Return the number of axis of the coordinate system of the CRS.

    Since

      GDAL 3.0

  const char *GetAxis(const char *pszTargetKey, int iAxis, OGRAxisOrientation *peOrientation, double *pdfConvFactor = nullptr) const

    Fetch the orientation of one axis.

    Fetches the request axis (iAxis - zero based) from the indicated portion of the coordinate system (pszTargetKey) which should be either "GEOGCS" or "PROJCS".

    No CPLError is issued on routine failures (such as not finding the AXIS).

    This method is equivalent to the C function OSRGetAxis().

    Parameters:

      - pszTargetKey -- the coordinate system part to query ("PROJCS" or "GEOGCS").

      - iAxis -- the axis to query (0 for first, 1 for second, 2 for third).

      - peOrientation -- location into which to place the fetch orientation, may be NULL.

      - pdfConvUnit -- (GDAL >= 3.4) Location into which to place axis conversion factor. May be NULL. Only set if pszTargetKey == NULL

    Returns:

      the name of the axis or NULL on failure.

  OGRErr SetAxes(const char *pszTargetKey, const char *pszXAxisName, OGRAxisOrientation eXAxisOrientation, const char *pszYAxisName, OGRAxisOrientation eYAxisOrientation)

    Set the axes for a coordinate system.

    Set the names, and orientations of the axes for either a projected (PROJCS) or geographic (GEOGCS) coordinate system.

    This method is equivalent to the C function OSRSetAxes().

    Parameters:

      - pszTargetKey -- either "PROJCS" or "GEOGCS", must already exist in SRS.

      - pszXAxisName -- name of first axis, normally "Long" or "Easting".

      - eXAxisOrientation -- normally OAO_East.

      - pszYAxisName -- name of second axis, normally "Lat" or "Northing".

      - eYAxisOrientation -- normally OAO_North.

    Returns:

      OGRERR_NONE on success or an error code.

  OSRAxisMappingStrategy GetAxisMappingStrategy() const

    Return the data axis to CRS axis mapping strategy.

    - OAMS_TRADITIONAL_GIS_ORDER means that for geographic CRS with lat/long order, the data will still be long/lat ordered. Similarly for a projected CRS with northing/easting order, the data will still be easting/northing ordered.

    - OAMS_AUTHORITY_COMPLIANT means that the data axis will be identical to the CRS axis.

    - OAMS_CUSTOM means that the data axis are customly defined with SetDataAxisToSRSAxisMapping()

    Since

      GDAL 3.0

    Returns:

      the data axis to CRS axis mapping strategy.

  void SetAxisMappingStrategy(OSRAxisMappingStrategy)

    Set the data axis to CRS axis mapping strategy.

    Starting with GDAL 3.5, the OSR_DEFAULT_AXIS_MAPPING_STRATEGY configuration option can be set to "TRADITIONAL_GIS_ORDER" / "AUTHORITY_COMPLIANT" (the later being the default value when the option is not set) to control the value of the data axis to CRS axis mapping strategy when a OSRSpatialReference object is created. Calling SetAxisMappingStrategy() will override this default value.

    See OGRSpatialReference::GetAxisMappingStrategy()

    Since

      GDAL 3.0

  const std::vector<int> &GetDataAxisToSRSAxisMapping() const

    Return the data axis to SRS axis mapping.

    The number of elements of the vector will be the number of axis of the CRS. Values start at 1.

    If m = GetDataAxisToSRSAxisMapping(), then m[0] is the data axis number for the first axis of the CRS.

    Since

      GDAL 3.0

  OGRErr SetDataAxisToSRSAxisMapping(const std::vector<int> &mapping)

    Set a custom data axis to CRS axis mapping.

    The number of elements of the mapping vector should be the number of axis of the CRS (as returned by GetAxesCount()) (although this method does not check that, beyond checking there are at least 2 elements, so that this method and setting the CRS can be done in any order). This is taken into account by OGRCoordinateTransformation to transform the order of coordinates to the order expected by the CRS before transformation, and back to the data order after transformation.

    The mapping[i] value (one based) represents the data axis number for the i(th) axis of the CRS. A negative value can also be used to ask for a sign reversal during coordinate transformation (to deal with northing vs southing, easting vs westing, heights vs depths).

    When used with OGRCoordinateTransformation,

    - the only valid values for mapping[0] (data axis number for the first axis of the CRS) are 1, 2, -1, -2.

    - the only valid values for mapping[1] (data axis number for the second axis of the CRS) are 1, 2, -1, -2.

      - the only valid values mapping[2] are 3 or -3. Note: this method does not validate the values of mapping[].

    mapping=[2,1] typically expresses the inversion of axis between the data axis and the CRS axis for a 2D CRS.

    Automatically implies SetAxisMappingStrategy(OAMS_CUSTOM)

    This is the same as the C function OSRSetDataAxisToSRSAxisMapping().

    See also

    OGRSpatialReference::GetDataAxisToSRSAxisMapping()

    Since

      GDAL 3.0

    Parameters:

      mapping -- The new data axis to CRS axis mapping.

  OGR_SRSNode *GetRoot()

    Return root node.

  const OGR_SRSNode *GetRoot() const

    Return root node.

  void SetRoot(OGR_SRSNode*)

    Set the root SRS node.

    If the object has an existing tree of OGR_SRSNodes, they are destroyed as part of assigning the new root. Ownership of the passed OGR_SRSNode is is assumed by the OGRSpatialReference.

    Parameters:

      poNewRoot -- object to assign as root.

  OGR_SRSNode *GetAttrNode(const char*)

    Find named node in tree.

    This method does a pre-order traversal of the node tree searching for a node with this exact value (case insensitive), and returns it. Leaf nodes are not considered, under the assumption that they are just attribute value nodes.

    If a node appears more than once in the tree (such as UNIT for instance), the first encountered will be returned. Use GetNode() on a subtree to be more specific.

    Parameters:

      pszNodePath -- the name of the node to search for. May contain multiple components such as "GEOGCS|UNIT".

    Returns:

      a pointer to the node found, or NULL if none.

  const OGR_SRSNode *GetAttrNode(const char*) const

    Find named node in tree.

    This method does a pre-order traversal of the node tree searching for a node with this exact value (case insensitive), and returns it. Leaf nodes are not considered, under the assumption that they are just attribute value nodes.

    If a node appears more than once in the tree (such as UNIT for instance), the first encountered will be returned. Use GetNode() on a subtree to be more specific.

    Parameters:

      pszNodePath -- the name of the node to search for. May contain multiple components such as "GEOGCS|UNIT".

    Returns:

      a pointer to the node found, or NULL if none.

  const char *GetAttrValue(const char*, int = 0) const

    Fetch indicated attribute of named node.

    This method uses GetAttrNode() to find the named node, and then extracts the value of the indicated child. Thus a call to GetAttrValue("UNIT",1) would return the second child of the UNIT node, which is normally the length of the linear unit in meters.

    This method does the same thing as the C function OSRGetAttrValue().

    Parameters:

      - pszNodeName -- the tree node to look for (case insensitive).

      - iAttr -- the child of the node to fetch (zero based).

    Returns:

      the requested value, or NULL if it fails for any reason.

  OGRErr SetNode(const char*, const char*)

    Set attribute value in spatial reference.

    Missing intermediate nodes in the path will be created if not already in existence. If the attribute has no children one will be created and assigned the value otherwise the zeroth child will be assigned the value.

    This method does the same as the C function OSRSetAttrValue().

    Parameters:

      - pszNodePath -- full path to attribute to be set. For instance "PROJCS|GEOGCS|UNIT".

      - pszNewNodeValue -- value to be assigned to node, such as "meter". This may be NULL if you just want to force creation of the intermediate path.

    Returns:

      OGRERR_NONE on success.

  OGRErr SetNode(const char*, double)

    Set attribute value in spatial reference.

    Missing intermediate nodes in the path will be created if not already in existence. If the attribute has no children one will be created and assigned the value otherwise the zeroth child will be assigned the value.

    This method does the same as the C function OSRSetAttrValue().

    Parameters:

      - pszNodePath -- full path to attribute to be set. For instance "PROJCS|GEOGCS|UNIT".

      - dfValue -- value to be assigned to node.

    Returns:

      OGRERR_NONE on success.

  OGRErr SetLinearUnitsAndUpdateParameters(const char *pszName, double dfInMeters, const char *pszUnitAuthority = nullptr, const char *pszUnitCode = nullptr)

    Set the linear units for the projection.

    This method creates a UNIT subnode with the specified values as a child of the PROJCS or LOCAL_CS node. It works the same as the SetLinearUnits() method, but it also updates all existing linear projection parameter values from the old units to the new units.

    Parameters:

      - pszName -- the units name to be used. Some preferred units names can be found in ogr_srs_api.h such as SRS_UL_METER, SRS_UL_FOOT and SRS_UL_US_FOOT.

      - dfInMeters -- the value to multiple by a length in the indicated units to transform to meters. Some standard conversion factors can be found in ogr_srs_api.h.

      - pszUnitAuthority -- Unit authority name. Or nullptr

      - pszUnitCode -- Unit code. Or nullptr

    Returns:

      OGRERR_NONE on success.

  OGRErr SetLinearUnits(const char *pszName, double dfInMeters)

    Set the linear units for the projection.

    This method creates a UNIT subnode with the specified values as a child of the PROJCS, GEOCCS, GEOGCS or LOCAL_CS node. When called on a Geographic 3D CRS the vertical axis units will be set.

    This method does the same as the C function OSRSetLinearUnits().

    Parameters:

      - pszUnitsName -- the units name to be used. Some preferred units names can be found in ogr_srs_api.h such as SRS_UL_METER, SRS_UL_FOOT and SRS_UL_US_FOOT.

      - dfInMeters -- the value to multiple by a length in the indicated units to transform to meters. Some standard conversion factors can be found in ogr_srs_api.h.

    Returns:

      OGRERR_NONE on success.

  OGRErr SetTargetLinearUnits(const char *pszTargetKey, const char *pszName, double dfInMeters, const char *pszUnitAuthority = nullptr, const char *pszUnitCode = nullptr)

    Set the linear units for the projection.

    This method creates a UNIT subnode with the specified values as a child of the target node.

    This method does the same as the C function OSRSetTargetLinearUnits().

    Parameters:

      - pszTargetKey -- the keyword to set the linear units for. i.e. "PROJCS" or "VERT_CS"

      - pszUnitsName -- the units name to be used. Some preferred units names can be found in ogr_srs_api.h such as SRS_UL_METER, SRS_UL_FOOT and SRS_UL_US_FOOT.

      - dfInMeters -- the value to multiple by a length in the indicated units to transform to meters. Some standard conversion factors can be found in ogr_srs_api.h.

      - pszUnitAuthority -- Unit authority name. Or nullptr

      - pszUnitCode -- Unit code. Or nullptr

    Returns:

      OGRERR_NONE on success.

  double GetLinearUnits(char**) const

    Fetch linear projection units.

    If no units are available, a value of "Meters" and 1.0 will be assumed. This method only checks directly under the PROJCS, GEOCCS, GEOGCS or LOCAL_CS node for units. When called on a Geographic 3D CRS the vertical axis units will be returned.

    This method does the same thing as the C function OSRGetLinearUnits()

    Deprecated:

      Use GetLinearUnits(const char**) const.

    Parameters:

      ppszName -- a pointer to be updated with the pointer to the units name. The returned value remains internal to the OGRSpatialReference and should not be freed, or modified. It may be invalidated on the next OGRSpatialReference call.

    Returns:

      the value to multiply by linear distances to transform them to meters.

  double GetLinearUnits(const char** = nullptr) const

    Fetch linear projection units.

    If no units are available, a value of "Meters" and 1.0 will be assumed. This method only checks directly under the PROJCS, GEOCCS or LOCAL_CS node for units.

    This method does the same thing as the C function OSRGetLinearUnits()

    Parameters:

      ppszName -- a pointer to be updated with the pointer to the units name. The returned value remains internal to the OGRSpatialReference and should not be freed, or modified. It may be invalidated on the next OGRSpatialReference call.

    Returns:

      the value to multiply by linear distances to transform them to meters.

  double GetTargetLinearUnits(const char *pszTargetKey, char **ppszRetName) const

    Fetch linear units for target.

    If no units are available, a value of "Meters" and 1.0 will be assumed.

    This method does the same thing as the C function OSRGetTargetLinearUnits()

    Parameters:

      - pszTargetKey -- the key to look on. i.e. "PROJCS" or "VERT_CS". Might be NULL, in which case PROJCS will be implied (and if not found, LOCAL_CS, GEOCCS and VERT_CS are looked up)

      - ppszName -- a pointer to be updated with the pointer to the units name. The returned value remains internal to the OGRSpatialReference and should not be freed, or modified. It may be invalidated on the next OGRSpatialReference call. ppszName can be set to NULL.

    Returns:

      the value to multiply by linear distances to transform them to meters.

  double GetTargetLinearUnits(const char *pszTargetKey, const char **ppszRetName = nullptr) const

    Fetch linear units for target.

    If no units are available, a value of "Meters" and 1.0 will be assumed.

    This method does the same thing as the C function OSRGetTargetLinearUnits()

    Deprecated:

      Use GetTargetLinearUnits(const char*, const char**) const.

    Parameters:

      - pszTargetKey -- the key to look on. i.e. "PROJCS" or "VERT_CS". Might be NULL, in which case PROJCS will be implied (and if not found, LOCAL_CS, GEOCCS, GEOGCS and VERT_CS are looked up)

      - ppszName -- a pointer to be updated with the pointer to the units name. The returned value remains internal to the OGRSpatialReference and should not be freed, or modified. It may be invalidated on the next OGRSpatialReference call. ppszName can be set to NULL.

    Returns:

      the value to multiply by linear distances to transform them to meters.

  OGRErr SetAngularUnits(const char *pszName, double dfInRadians)

    Set the angular units for the geographic coordinate system.

    This method creates a UNIT subnode with the specified values as a child of the GEOGCS node.

    This method does the same as the C function OSRSetAngularUnits().

    Parameters:

      - pszUnitsName -- the units name to be used. Some preferred units names can be found in ogr_srs_api.h such as SRS_UA_DEGREE.

      - dfInRadians -- the value to multiple by an angle in the indicated units to transform to radians. Some standard conversion factors can be found in ogr_srs_api.h.

    Returns:

      OGRERR_NONE on success.

  double GetAngularUnits(char**) const

    Fetch angular geographic coordinate system units.

    If no units are available, a value of "degree" and SRS_UA_DEGREE_CONV will be assumed. This method only checks directly under the GEOGCS node for units.

    This method does the same thing as the C function OSRGetAngularUnits().

    Deprecated:

      Use GetAngularUnits(const char**) const.

    Parameters:

      ppszName -- a pointer to be updated with the pointer to the units name. The returned value remains internal to the OGRSpatialReference and should not be freed, or modified. It may be invalidated on the next OGRSpatialReference call.

    Returns:

      the value to multiply by angular distances to transform them to radians.

  double GetAngularUnits(const char** = nullptr) const

    Fetch angular geographic coordinate system units.

    If no units are available, a value of "degree" and SRS_UA_DEGREE_CONV will be assumed. This method only checks directly under the GEOGCS node for units.

    This method does the same thing as the C function OSRGetAngularUnits().

    Parameters:

      ppszName -- a pointer to be updated with the pointer to the units name. The returned value remains internal to the OGRSpatialReference and should not be freed, or modified. It may be invalidated on the next OGRSpatialReference call.

    Returns:

      the value to multiply by angular distances to transform them to radians.

  double GetPrimeMeridian(char**) const

    Fetch prime meridian info.

    Returns the offset of the prime meridian from greenwich in degrees, and the prime meridian name (if requested). If no PRIMEM value exists in the coordinate system definition a value of "Greenwich" and an offset of 0.0 is assumed.

    If the prime meridian name is returned, the pointer is to an internal copy of the name. It should not be freed, altered or depended on after the next OGR call.

    This method is the same as the C function OSRGetPrimeMeridian().

    Parameters:

      ppszName -- return location for prime meridian name. If NULL, name is not returned.

    Returns:

      the offset to the GEOGCS prime meridian from greenwich in decimal degrees.

  double GetPrimeMeridian(const char** = nullptr) const

    Fetch prime meridian info.

    Returns the offset of the prime meridian from greenwich in degrees, and the prime meridian name (if requested). If no PRIMEM value exists in the coordinate system definition a value of "Greenwich" and an offset of 0.0 is assumed.

    If the prime meridian name is returned, the pointer is to an internal copy of the name. It should not be freed, altered or depended on after the next OGR call.

    This method is the same as the C function OSRGetPrimeMeridian().

    Deprecated:

      Use GetPrimeMeridian(const char**) const.

    Parameters:

      ppszName -- return location for prime meridian name. If NULL, name is not returned.

    Returns:

      the offset to the GEOGCS prime meridian from greenwich in decimal degrees.

  bool IsEmpty() const

    Return if the SRS is not set.

  int IsGeographic() const

    Check if geographic coordinate system.

    This method is the same as the C function OSRIsGeographic().

    Returns:

      TRUE if this spatial reference is geographic ... that is the root is a GEOGCS node. Also if it is a CompoundCRS made of a GeographicCRS

  int IsDerivedGeographic() const

    Check if the CRS is a derived geographic coordinate system.

    (for example a rotated long/lat grid)

    This method is the same as the C function OSRIsDerivedGeographic().

    Since

      GDAL 3.1.0 and PROJ 6.3.0

  int IsProjected() const

    Check if projected coordinate system.

    This method is the same as the C function OSRIsProjected().

    Returns:

      TRUE if this contains a PROJCS node indicating a it is a projected coordinate system. Also if it is a CompoundCRS made of a ProjectedCRS

  int IsDerivedProjected() const

    Check if the CRS is a derived projected coordinate system.

    This method is the same as the C function OSRIsDerivedGeographic().

    Since

      GDAL 3.9.0 (and may only return non-zero starting with PROJ 9.2.0)

  int IsGeocentric() const

    Check if geocentric coordinate system.

    This method is the same as the C function OSRIsGeocentric().

    Returns:

      TRUE if this contains a GEOCCS node indicating a it is a geocentric coordinate system.

  bool IsDynamic() const

    Check if a CRS is a dynamic CRS.

    A dynamic CRS relies on a dynamic datum, that is a datum that is not plate-fixed.

    This method is the same as the C function OSRIsDynamic().

    See also

    HasPointMotionOperation()

    Since

      OGR 3.4.0

    Returns:

      true if the CRS is dynamic

  bool HasPointMotionOperation() const

    Check if a CRS has at least an associated point motion operation.

    Some CRS are not formally declared as dynamic, but may behave as such in practice due to the presence of point motion operation, to perform coordinate epoch changes within the CRS. Typically NAD83(CSRS)v7

    See also

    IsDynamic()

    Since

      OGR 3.8.0 and PROJ 9.4.0

    Returns:

      true if the CRS has at least an associated point motion operation.

  int IsLocal() const

    Check if local coordinate system.

    This method is the same as the C function OSRIsLocal().

    Returns:

      TRUE if this spatial reference is local ... that is the root is a LOCAL_CS node.

  int IsVertical() const

    Check if vertical coordinate system.

    This method is the same as the C function OSRIsVertical().

    Returns:

      TRUE if this contains a VERT_CS node indicating a it is a vertical coordinate system. Also if it is a CompoundCRS made of a VerticalCRS

  int IsCompound() const

    Check if coordinate system is compound.

    This method is the same as the C function OSRIsCompound().

    Returns:

      TRUE if this is rooted with a COMPD_CS node.

  int IsSameGeogCS(const OGRSpatialReference*) const

    Do the GeogCS'es match?

    This method is the same as the C function OSRIsSameGeogCS().

    Parameters:

      poOther -- the SRS being compared against.

    Returns:

      TRUE if they are the same or FALSE otherwise.

  int IsSameGeogCS(const OGRSpatialReference*, const char *const *papszOptions) const

    Do the GeogCS'es match?

    This method is the same as the C function OSRIsSameGeogCS().

    Parameters:

      - poOther -- the SRS being compared against.

      - papszOptions -- options. ignored

    Returns:

      TRUE if they are the same or FALSE otherwise.

  int IsSameVertCS(const OGRSpatialReference*) const

    Do the VertCS'es match?

    This method is the same as the C function OSRIsSameVertCS().

    Parameters:

      poOther -- the SRS being compared against.

    Returns:

      TRUE if they are the same or FALSE otherwise.

  int IsSame(const OGRSpatialReference*) const

    Do these two spatial references describe the same system ?

    Parameters:

      poOtherSRS -- the SRS being compared to.

    Returns:

      TRUE if equivalent or FALSE otherwise.

  int IsSame(const OGRSpatialReference*, const char *const *papszOptions) const

    Do these two spatial references describe the same system ?

    This also takes into account the data axis to CRS axis mapping by default

    Parameters:

      - poOtherSRS -- the SRS being compared to.

      - papszOptions -- options. NULL or NULL terminated list of options. Currently supported options are:

        - IGNORE_DATA_AXIS_TO_SRS_AXIS_MAPPING=YES/NO. Defaults to NO

        - CRITERION=STRICT/EQUIVALENT/EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS. Defaults to EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS.

        - IGNORE_COORDINATE_EPOCH=YES/NO. Defaults to NO

    Returns:

      TRUE if equivalent or FALSE otherwise.

  const char *GetCelestialBodyName() const

    Return the name of the celestial body of this CRS.

    e.g. "Earth" for an Earth CRS

    The returned value is only short lived and should not be used after other calls to methods on this object.

    Since

      GDAL 3.12 and PROJ 8.1

  void Clear()

    Wipe current definition.

    Returns OGRSpatialReference to a state with no definition, as it exists when first created. It does not affect reference counts.

  OGRErr SetLocalCS(const char*)

    Set the user visible LOCAL_CS name.

    This method is the same as the C function OSRSetLocalCS().

    This method will ensure a LOCAL_CS node is created as the root, and set the provided name on it. It must be used before SetLinearUnits().

    Parameters:

      pszName -- the user visible name to assign. Not used as a key.

    Returns:

      OGRERR_NONE on success.

  OGRErr SetProjCS(const char*)

    Set the user visible PROJCS name.

    This method is the same as the C function OSRSetProjCS().

    This method will ensure a PROJCS node is created as the root, and set the provided name on it. If used on a GEOGCS coordinate system, the GEOGCS node will be demoted to be a child of the new PROJCS root.

    Parameters:

      pszName -- the user visible name to assign. Not used as a key.

    Returns:

      OGRERR_NONE on success.

  OGRErr SetProjection(const char*)

    Set a projection name.

    This method is the same as the C function OSRSetProjection().

    Parameters:

      pszProjection -- the projection name, which should be selected from the macros in ogr_srs_api.h, such as SRS_PT_TRANSVERSE_MERCATOR.

    Returns:

      OGRERR_NONE on success.

  OGRErr SetGeocCS(const char *pszGeocName)

    Set the user visible GEOCCS name.

    This method is the same as the C function OSRSetGeocCS().

    This method will ensure a GEOCCS node is created as the root, and set the provided name on it. If used on a GEOGCS coordinate system, the DATUM and PRIMEM nodes from the GEOGCS will be transferred over to the GEOGCS.

    Parameters:

      pszName -- the user visible name to assign. Not used as a key.

    Returns:

      OGRERR_NONE on success.

  OGRErr SetGeogCS(const char *pszGeogName, const char *pszDatumName, const char *pszEllipsoidName, double dfSemiMajor, double dfInvFlattening, const char *pszPMName = nullptr, double dfPMOffset = 0.0, const char *pszUnits = nullptr, double dfConvertToRadians = 0.0)

    Set geographic coordinate system.

    This method is used to set the datum, ellipsoid, prime meridian and angular units for a geographic coordinate system. It can be used on its own to establish a geographic spatial reference, or applied to a projected coordinate system to establish the underlying geographic coordinate system.

    This method does the same as the C function OSRSetGeogCS().

    Parameters:

      - pszGeogName -- user visible name for the geographic coordinate system (not to serve as a key).

      - pszDatumName -- key name for this datum. The OpenGIS specification lists some known values, and otherwise EPSG datum names with a standard transformation are considered legal keys.

      - pszSpheroidName -- user visible spheroid name (not to serve as a key)

      - dfSemiMajor -- the semi major axis of the spheroid.

      - dfInvFlattening -- the inverse flattening for the spheroid. This can be computed from the semi minor axis as 1/f = 1.0 / (1.0 - semiminor/semimajor).

      - pszPMName -- the name of the prime meridian (not to serve as a key) If this is NULL a default value of "Greenwich" will be used.

      - dfPMOffset -- the longitude of Greenwich relative to this prime meridian. Always in Degrees

      - pszAngularUnits -- the angular units name (see ogr_srs_api.h for some standard names). If NULL a value of "degrees" will be assumed.

      - dfConvertToRadians -- value to multiply angular units by to transform them to radians. A value of SRS_UA_DEGREE_CONV will be used if pszAngularUnits is NULL.

    Returns:

      OGRERR_NONE on success.

  OGRErr SetWellKnownGeogCS(const char*)

    Set a GeogCS based on well known name.

    This may be called on an empty OGRSpatialReference to make a geographic coordinate system, or on something with an existing PROJCS node to set the underlying geographic coordinate system of a projected coordinate system.

    The following well known text values are currently supported, Except for "EPSG:n", the others are without dependency on EPSG data files:

    - "EPSG:n": where n is the code a Geographic coordinate reference system.

    - "WGS84": same as "EPSG:4326" (axis order lat/long).

    - "WGS72": same as "EPSG:4322" (axis order lat/long).

    - "NAD83": same as "EPSG:4269" (axis order lat/long).

    - "NAD27": same as "EPSG:4267" (axis order lat/long).

    - "CRS84", "CRS:84": same as "WGS84" but with axis order long/lat.

    - "CRS72", "CRS:72": same as "WGS72" but with axis order long/lat.

    - "CRS27", "CRS:27": same as "NAD27" but with axis order long/lat.

    Parameters:

      pszName -- name of well known geographic coordinate system.

    Returns:

      OGRERR_NONE on success, or OGRERR_FAILURE if the name isn't recognised, the target object is already initialized, or an EPSG value can't be successfully looked up.

  OGRErr CopyGeogCSFrom(const OGRSpatialReference *poSrcSRS)

    Copy GEOGCS from another OGRSpatialReference.

    The GEOGCS information is copied into this OGRSpatialReference from another. If this object has a PROJCS root already, the GEOGCS is installed within it, otherwise it is installed as the root.

    Parameters:

      poSrcSRS -- the spatial reference to copy the GEOGCS information from.

    Returns:

      OGRERR_NONE on success or an error code.

  OGRErr SetVertCS(const char *pszVertCSName, const char *pszVertDatumName, int nVertDatumClass = 2005)

    Set the user visible VERT_CS name.

    This method is the same as the C function OSRSetVertCS().

    This method will ensure a VERT_CS node is created if needed. If the existing coordinate system is GEOGCS or PROJCS rooted, then it will be turned into a COMPD_CS.

    Parameters:

      - pszVertCSName -- the user visible name of the vertical coordinate system. Not used as a key.

      - pszVertDatumName -- the user visible name of the vertical datum. It is helpful if this matches the EPSG name.

      - nVertDatumType -- the OGC vertical datum type. Ignored

    Returns:

      OGRERR_NONE on success.

  OGRErr SetCompoundCS(const char *pszName, const OGRSpatialReference *poHorizSRS, const OGRSpatialReference *poVertSRS)

    Setup a compound coordinate system.

    This method is the same as the C function OSRSetCompoundCS().

    This method is replace the current SRS with a COMPD_CS coordinate system consisting of the passed in horizontal and vertical coordinate systems.

    Parameters:

      - pszName -- the name of the compound coordinate system.

      - poHorizSRS -- the horizontal SRS (PROJCS or GEOGCS).

      - poVertSRS -- the vertical SRS (VERT_CS).

    Returns:

      OGRERR_NONE on success.

  void SetCoordinateEpoch(double dfCoordinateEpoch)

    Set the coordinate epoch, as decimal year.

    In a dynamic CRS, coordinates of a point on the surface of the Earth may change with time. To be unambiguous the coordinates must always be qualified with the epoch at which they are valid. The coordinate epoch is not necessarily the epoch at which the observation was collected.

    Pedantically the coordinate epoch of an observation belongs to the observation, and not to the CRS, however it is often more practical to bind it to the CRS. The coordinate epoch should be specified for dynamic CRS (see IsDynamic())

    This method is the same as the OSRSetCoordinateEpoch() function.

    Since

      OGR 3.4

    Parameters:

      dfCoordinateEpoch -- Coordinate epoch as decimal year (e.g. 2021.3)

  double GetCoordinateEpoch() const

    Return the coordinate epoch, as decimal year.

    In a dynamic CRS, coordinates of a point on the surface of the Earth may change with time. To be unambiguous the coordinates must always be qualified with the epoch at which they are valid. The coordinate epoch is not necessarily the epoch at which the observation was collected.

    Pedantically the coordinate epoch of an observation belongs to the observation, and not to the CRS, however it is often more practical to bind it to the CRS. The coordinate epoch should be specified for dynamic CRS (see IsDynamic())

    This method is the same as the OSRGetCoordinateEpoch() function.

    Since

      OGR 3.4

    Returns:

      coordinateEpoch Coordinate epoch as decimal year (e.g. 2021.3), or 0 if not set, or relevant.

  OGRErr PromoteTo3D(const char *pszName)

    "Promotes" a 2D CRS to a 3D CRS one.

    The new axis will be ellipsoidal height, oriented upwards, and with metre units.

    Since

      GDAL 3.1 and PROJ 6.3

    Parameters:

      pszName -- New name for the CRS. If set to NULL, the previous name will be used.

    Returns:

      OGRERR_NONE if no error occurred.

  OGRErr DemoteTo2D(const char *pszName)

    "Demote" a 3D CRS to a 2D CRS one.

    Since

      GDAL 3.2 and PROJ 6.3

    Parameters:

      pszName -- New name for the CRS. If set to NULL, the previous name will be used.

    Returns:

      OGRERR_NONE if no error occurred.

  OGRErr SetFromUserInput(const char*)

    Set spatial reference from various text formats.

    This method will examine the provided input, and try to deduce the format, and then use it to initialize the spatial reference system. It may take the following forms:

    1. Well Known Text definition - passed on to importFromWkt().

    2. "EPSG:n" - number passed on to importFromEPSG().

    3. "EPSGA:n" - number passed on to importFromEPSGA().

    4. "AUTO:proj_id,unit_id,lon0,lat0" - WMS auto projections.

    5. "urn:ogc:def:crs:EPSG::n" - ogc urns

    6. PROJ.4 definitions - passed on to importFromProj4().

    7. filename - file read for WKT, XML or PROJ.4 definition.

    8. well known name accepted by SetWellKnownGeogCS(), such as NAD27, NAD83, WGS84 or WGS72.

    9. "IGNF:xxxx", "ESRI:xxxx", etc. from definitions from the PROJ database;

    10. PROJJSON (PROJ >= 6.2)

    It is expected that this method will be extended in the future to support XML and perhaps a simplified "minilanguage" for indicating common UTM and State Plane definitions.

    This method is intended to be flexible, but by its nature it is imprecise as it must guess information about the format intended. When possible applications should call the specific method appropriate if the input is known to be in a particular format.

    This method does the same thing as the OSRSetFromUserInput() function.

    Parameters:

      pszDefinition -- text definition to try to deduce SRS from.

    Returns:

      OGRERR_NONE on success, or an error code if the name isn't recognised, the definition is corrupt, or an EPSG value can't be successfully looked up.

  OGRErr SetFromUserInput(const char*, CSLConstList papszOptions)

    Set spatial reference from various text formats.

    This method will examine the provided input, and try to deduce the format, and then use it to initialize the spatial reference system. It may take the following forms:

    1. Well Known Text definition - passed on to importFromWkt().

    2. "EPSG:n" - number passed on to importFromEPSG().

    3. "EPSGA:n" - number passed on to importFromEPSGA().

    4. "AUTO:proj_id,unit_id,lon0,lat0" - WMS auto projections.

    5. "urn:ogc:def:crs:EPSG::n" - ogc urns

    6. PROJ.4 definitions - passed on to importFromProj4().

    7. filename - file read for WKT, XML or PROJ.4 definition.

    8. well known name accepted by SetWellKnownGeogCS(), such as NAD27, NAD83, WGS84 or WGS72.

    9. "IGNF:xxxx", "ESRI:xxxx", etc. from definitions from the PROJ database;

    10. PROJJSON (PROJ >= 6.2)

    It is expected that this method will be extended in the future to support XML and perhaps a simplified "minilanguage" for indicating common UTM and State Plane definitions.

    This method is intended to be flexible, but by its nature it is imprecise as it must guess information about the format intended. When possible applications should call the specific method appropriate if the input is known to be in a particular format.

    This method does the same thing as the OSRSetFromUserInput() and OSRSetFromUserInputEx() functions.

    Parameters:

      - pszDefinition -- text definition to try to deduce SRS from.

      - papszOptions -- NULL terminated list of options, or NULL.

        1. ALLOW_NETWORK_ACCESS=YES/NO. Whether http:// or https:// access is allowed. Defaults to YES.

        2. ALLOW_FILE_ACCESS=YES/NO. Whether reading a file using the Virtual File System layer is allowed (can also involve network access). Defaults to YES.

    Returns:

      OGRERR_NONE on success, or an error code if the name isn't recognised, the definition is corrupt, or an EPSG value can't be successfully looked up.

  OGRErr SetTOWGS84(double, double, double, double = 0.0, double = 0.0, double = 0.0, double = 0.0)

    Set the Bursa-Wolf conversion to WGS84.

    This will create the TOWGS84 node as a child of the DATUM. It will fail if there is no existing DATUM node. It will replace an existing TOWGS84 node if there is one.

    The parameters have the same meaning as EPSG transformation 9606 (Position Vector 7-param. transformation).

    This method is the same as the C function OSRSetTOWGS84().

    Parameters:

      - dfDX -- X child in meters.

      - dfDY -- Y child in meters.

      - dfDZ -- Z child in meters.

      - dfEX -- X rotation in arc seconds (optional, defaults to zero).

      - dfEY -- Y rotation in arc seconds (optional, defaults to zero).

      - dfEZ -- Z rotation in arc seconds (optional, defaults to zero).

      - dfPPM -- scaling factor (parts per million).

    Returns:

      OGRERR_NONE on success.

  OGRErr GetTOWGS84(double *padfCoef, int nCoeff = 7) const

    Fetch TOWGS84 parameters, if available.

    The parameters have the same meaning as EPSG transformation 9606 (Position Vector 7-param. transformation).

    Parameters:

      - padfCoeff -- array into which up to 7 coefficients are placed.

      - nCoeffCount -- size of padfCoeff - defaults to 7.

    Returns:

      OGRERR_NONE on success, or OGRERR_FAILURE if there is no TOWGS84 node available.

  OGRErr AddGuessedTOWGS84()

    Try to add a a 3-parameter or 7-parameter Helmert transformation to WGS84.

    This method try to attach a 3-parameter or 7-parameter Helmert transformation to WGS84 when there is one and only one such method available for the CRS. Note: this is more restrictive to how GDAL < 3 worked.

    This method is the same as the C function OSRAddGuessedTOWGS84().

    Since

      GDAL 3.0.3

    Returns:

      OGRERR_NONE on success, or an error code on failure (the CRS has already a transformation to WGS84 or none matching could be found).

  double GetSemiMajor(OGRErr* = nullptr) const

    Get spheroid semi major axis (in metres starting with GDAL 3.0)

    This method does the same thing as the C function OSRGetSemiMajor().

    Parameters:

      pnErr -- if non-NULL set to OGRERR_FAILURE if semi major axis can be found.

    Returns:

      semi-major axis, or SRS_WGS84_SEMIMAJOR if it can't be found.

  double GetSemiMinor(OGRErr* = nullptr) const

    Get spheroid semi minor axis.

    This method does the same thing as the C function OSRGetSemiMinor().

    Parameters:

      pnErr -- if non-NULL set to OGRERR_FAILURE if semi minor axis can be found.

    Returns:

      semi-minor axis, or WGS84 semi minor if it can't be found.

  double GetInvFlattening(OGRErr* = nullptr) const

    Get spheroid inverse flattening.

    This method does the same thing as the C function OSRGetInvFlattening().

    Parameters:

      pnErr -- if non-NULL set to OGRERR_FAILURE if no inverse flattening can be found.

    Returns:

      inverse flattening, or SRS_WGS84_INVFLATTENING if it can't be found.

  double GetEccentricity() const

    Get spheroid eccentricity.

    Returns:

      eccentricity (or -1 in case of error)

  double GetSquaredEccentricity() const

    Get spheroid squared eccentricity.

    Returns:

      squared eccentricity (or -1 in case of error)

  OGRErr SetAuthority(const char *pszTargetKey, const char *pszAuthority, int nCode)

    Set the authority for a node.

    This method is the same as the C function OSRSetAuthority().

    Parameters:

      - pszTargetKey -- the partial or complete path to the node to set an authority on. i.e. "PROJCS", "GEOGCS" or "GEOGCS|UNIT".

      - pszAuthority -- authority name, such as "EPSG".

      - nCode -- code for value with this authority.

    Returns:

      OGRERR_NONE on success.

  OGRErr AutoIdentifyEPSG()

    Set EPSG authority info if possible.

    This method inspects a WKT definition, and adds EPSG authority nodes where an aspect of the coordinate system can be easily and safely corresponded with an EPSG identifier. In practice, this method will evolve over time. In theory it can add authority nodes for any object (i.e. spheroid, datum, GEOGCS, units, and PROJCS) that could have an authority node. Mostly this is useful to inserting appropriate PROJCS codes for common formulations (like UTM n WGS84).

    If it success the OGRSpatialReference is updated in place, and the method return OGRERR_NONE. If the method fails to identify the general coordinate system OGRERR_UNSUPPORTED_SRS is returned but no error message is posted via CPLError().

    This method is the same as the C function OSRAutoIdentifyEPSG().

    The FindMatches() method can also be used for improved matching by researching the EPSG catalog.

    See also

    OGRSpatialReference::FindBestMatch()

    Returns:

      OGRERR_NONE or OGRERR_UNSUPPORTED_SRS.

  OGRSpatialReferenceH *FindMatches(char **papszOptions, int *pnEntries, int **ppanMatchConfidence) const

    Try to identify a match between the passed SRS and a related SRS in a catalog.

    Matching may be partial, or may fail. Returned entries will be sorted by decreasing match confidence (first entry has the highest match confidence).

    The exact way matching is done may change in future versions. Starting with GDAL 3.0, it relies on PROJ' proj_identify() function.

    This method is the same as OSRFindMatches().

    See also

    OGRSpatialReference::FindBestMatch()

    Parameters:

      - papszOptions -- NULL terminated list of options or NULL

      - pnEntries -- Output parameter. Number of values in the returned array.

      - ppanMatchConfidence -- Output parameter (or NULL). *ppanMatchConfidence will be allocated to an array of *pnEntries whose values between 0 and 100 indicate the confidence in the match. 100 is the highest confidence level. The array must be freed with CPLFree().

    Returns:

      an array of SRS that match the passed SRS, or NULL. Must be freed with OSRFreeSRSArray()

  OGRSpatialReference *FindBestMatch(int nMinimumMatchConfidence = 90, const char *pszPreferredAuthority = "EPSG", CSLConstList papszOptions = nullptr) const

    Try to identify the best match between the passed SRS and a related SRS in a catalog.

    This is a wrapper over OGRSpatialReference::FindMatches() that takes care of filtering its output. Only matches whose confidence is greater or equal to nMinimumMatchConfidence will be considered. If there is a single match, it is returned. If there are several matches, only return the one under the pszPreferredAuthority, if there is a single one under that authority.

    See also

    OGRSpatialReference::FindMatches()

    Since

      GDAL 3.6

    Parameters:

      - nMinimumMatchConfidence -- Minimum match confidence (value between 0 and 100). If set to 0, 90 is used.

      - pszPreferredAuthority -- Preferred CRS authority. If set to nullptr, "EPSG" is used.

      - papszOptions -- NULL terminated list of options or NULL. No option is defined at time of writing.

    Returns:

      a new OGRSpatialReference* object to free with Release(), or nullptr

  int GetEPSGGeogCS() const

    Try to establish what the EPSG code for this coordinate systems GEOGCS might be.

    Returns -1 if no reasonable guess can be made.

    Returns:

      EPSG code

  const char *GetAuthorityCode(const char *pszTargetKey) const

    Get the authority code for a node.

    This method is used to query an AUTHORITY[] node from within the WKT tree, and fetch the code value.

    While in theory values may be non-numeric, for the EPSG authority all code values should be integral.

    This method is the same as the C function OSRGetAuthorityCode().

    Parameters:

      pszTargetKey -- the partial or complete path to the node to get an authority from. i.e. "PROJCS", "GEOGCS", "GEOGCS|UNIT" or NULL to search for an authority node on the root element.

    Returns:

      value code from authority node, or NULL on failure. The value returned is internal and should not be freed or modified.

  const char *GetAuthorityName(const char *pszTargetKey) const

    Get the authority name for a node.

    This method is used to query an AUTHORITY[] node from within the WKT tree, and fetch the authority name value.

    The most common authority is "EPSG".

    This method is the same as the C function OSRGetAuthorityName().

    Parameters:

      pszTargetKey -- the partial or complete path to the node to get an authority from. i.e. "PROJCS", "GEOGCS", "GEOGCS|UNIT" or NULL to search for an authority node on the root element.

    Returns:

      value code from authority node, or NULL on failure. The value returned is internal and should not be freed or modified.

  char *GetOGCURN() const

    Get a OGC URN string describing the CRS, when possible.

    This method assumes that the CRS has a top-level identifier, or is a compound CRS whose horizontal and vertical parts have a top-level identifier.

    Since

      GDAL 3.5

    Returns:

      a string to free with CPLFree(), or nullptr when no result can be generated

  bool GetAreaOfUse(double *pdfWestLongitudeDeg, double *pdfSouthLatitudeDeg, double *pdfEastLongitudeDeg, double *pdfNorthLatitudeDeg, const char **ppszAreaName) const

    Return the area of use of the CRS.

    This method is the same as the OSRGetAreaOfUse() function.

    Since

      GDAL 3.0

    Parameters:

      - pdfWestLongitudeDeg -- Pointer to a double to receive the western-most longitude, expressed in degree. Might be NULL. If the returned value is -1000, the bounding box is unknown.

      - pdfSouthLatitudeDeg -- Pointer to a double to receive the southern-most latitude, expressed in degree. Might be NULL. If the returned value is -1000, the bounding box is unknown.

      - pdfEastLongitudeDeg -- Pointer to a double to receive the eastern-most longitude, expressed in degree. Might be NULL. If the returned value is -1000, the bounding box is unknown.

      - pdfNorthLatitudeDeg -- Pointer to a double to receive the northern-most latitude, expressed in degree. Might be NULL. If the returned value is -1000, the bounding box is unknown.

      - ppszAreaName -- Pointer to a string to receive the name of the area of use. Might be NULL. Note that *ppszAreaName is short-lived and might be invalidated by further calls.

    Returns:

      true in case of success

  const char *GetExtension(const char *pszTargetKey, const char *pszName, const char *pszDefault = nullptr) const

    Fetch extension value.

    Fetch the value of the named EXTENSION item for the identified target node.

    Parameters:

      - pszTargetKey -- the name or path to the parent node of the EXTENSION.

      - pszName -- the name of the extension being fetched.

      - pszDefault -- the value to return if the extension is not found.

    Returns:

      node value if successful or pszDefault on failure.

  OGRErr SetExtension(const char *pszTargetKey, const char *pszName, const char *pszValue)

    Set extension value.

    Set the value of the named EXTENSION item for the identified target node.

    Parameters:

      - pszTargetKey -- the name or path to the parent node of the EXTENSION.

      - pszName -- the name of the extension being fetched.

      - pszValue -- the value to set

    Returns:

      OGRERR_NONE on success

  int FindProjParm(const char *pszParameter, const OGR_SRSNode *poPROJCS = nullptr) const

    Return the child index of the named projection parameter on its parent PROJCS node.

    Parameters:

      - pszParameter -- projection parameter to look for

      - poPROJCS -- projection CS node to look in. If NULL is passed, the PROJCS node of the SpatialReference object will be searched.

    Returns:

      the child index of the named projection parameter. -1 on failure

  OGRErr SetProjParm(const char*, double)

    Set a projection parameter value.

    Adds a new PARAMETER under the PROJCS with the indicated name and value.

    This method is the same as the C function OSRSetProjParm().

    Please check https://gdal.org/proj_list pages for legal parameter names for specific projections.

    Parameters:

      - pszParamName -- the parameter name, which should be selected from the macros in ogr_srs_api.h, such as SRS_PP_CENTRAL_MERIDIAN.

      - dfValue -- value to assign.

    Returns:

      OGRERR_NONE on success.

  double GetProjParm(const char*, double = 0.0, OGRErr* = nullptr) const

    Fetch a projection parameter value.

    NOTE: This code should be modified to translate non degree angles into degrees based on the GEOGCS unit. This has not yet been done.

    This method is the same as the C function OSRGetProjParm().

    Parameters:

      - pszName -- the name of the parameter to fetch, from the set of SRS_PP codes in ogr_srs_api.h.

      - dfDefaultValue -- the value to return if this parameter doesn't exist.

      - pnErr -- place to put error code on failure. Ignored if NULL.

    Returns:

      value of parameter.

  OGRErr SetNormProjParm(const char*, double)

    Set a projection parameter with a normalized value.

    This method is the same as SetProjParm() except that the value of the parameter passed in is assumed to be in "normalized" form (decimal degrees for angular values, meters for linear values. The values are converted in a form suitable for the GEOGCS and linear units in effect.

    This method is the same as the C function OSRSetNormProjParm().

    Parameters:

      - pszName -- the parameter name, which should be selected from the macros in ogr_srs_api.h, such as SRS_PP_CENTRAL_MERIDIAN.

      - dfValue -- value to assign.

    Returns:

      OGRERR_NONE on success.

  double GetNormProjParm(const char*, double = 0.0, OGRErr* = nullptr) const

    Fetch a normalized projection parameter value.

    This method is the same as GetProjParm() except that the value of the parameter is "normalized" into degrees or meters depending on whether it is linear or angular.

    This method is the same as the C function OSRGetNormProjParm().

    Parameters:

      - pszName -- the name of the parameter to fetch, from the set of SRS_PP codes in ogr_srs_api.h.

      - dfDefaultValue -- the value to return if this parameter doesn't exist.

      - pnErr -- place to put error code on failure. Ignored if NULL.

    Returns:

      value of parameter.

  OGRErr SetACEA(double dfStdP1, double dfStdP2, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

    Albers Conic Equal Area.

  OGRErr SetAE(double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

    Azimuthal Equidistant.

  OGRErr SetBonne(double dfStdP1, double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)

    Bonne.

  OGRErr SetCEA(double dfStdP1, double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)

    Cylindrical Equal Area.

  OGRErr SetCS(double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

    Cassini-Soldner.

  OGRErr SetEC(double dfStdP1, double dfStdP2, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

    Equidistant Conic.

  OGRErr SetEckert(int nVariation, double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)

    Eckert I.

  OGRErr SetEckertIV(double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)

    Eckert IV.

  OGRErr SetEckertVI(double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)

    Eckert VI.

  OGRErr SetEquirectangular(double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

    Equirectangular.

  OGRErr SetEquirectangular2(double dfCenterLat, double dfCenterLong, double dfPseudoStdParallel1, double dfFalseEasting, double dfFalseNorthing)

    Equirectangular generalized form :

  OGRErr SetGEOS(double dfCentralMeridian, double dfSatelliteHeight, double dfFalseEasting, double dfFalseNorthing)

    Geostationary Satellite.

  OGRErr SetGH(double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)

    Goode Homolosine.

  OGRErr SetIGH()

    Interrupted Goode Homolosine.

  OGRErr SetGS(double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)

    Gall Stereographic.

  OGRErr SetGaussSchreiberTMercator(double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)

    Gauss Schreiber Transverse Mercator.

  OGRErr SetGnomonic(double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

    Gnomonic.

  OGRErr SetHOM(double dfCenterLat, double dfCenterLong, double dfAzimuth, double dfRectToSkew, double dfScale, double dfFalseEasting, double dfFalseNorthing)

    Hotine Oblique Mercator.

    Set a Hotine Oblique Mercator projection using azimuth angle.

    This projection corresponds to EPSG projection method 9812, also sometimes known as hotine oblique mercator (variant A)..

    This method does the same thing as the C function OSRSetHOM().

    Parameters:

      - dfCenterLat -- Latitude of the projection origin.

      - dfCenterLong -- Longitude of the projection origin.

      - dfAzimuth -- Azimuth, measured clockwise from North, of the projection centerline.

      - dfRectToSkew -- Angle from Rectified to Skew Grid

      - dfScale -- Scale factor applies to the projection origin.

      - dfFalseEasting -- False easting.

      - dfFalseNorthing -- False northing.

    Returns:

      OGRERR_NONE on success.

  OGRErr SetHOM2PNO(double dfCenterLat, double dfLat1, double dfLong1, double dfLat2, double dfLong2, double dfScale, double dfFalseEasting, double dfFalseNorthing)

    Hotine Oblique Mercator 2 points.

    Set a Hotine Oblique Mercator projection using two points on projection centerline.

    This method does the same thing as the C function OSRSetHOM2PNO().

    Parameters:

      - dfCenterLat -- Latitude of the projection origin.

      - dfLat1 -- Latitude of the first point on center line.

      - dfLong1 -- Longitude of the first point on center line.

      - dfLat2 -- Latitude of the second point on center line.

      - dfLong2 -- Longitude of the second point on center line.

      - dfScale -- Scale factor applies to the projection origin.

      - dfFalseEasting -- False easting.

      - dfFalseNorthing -- False northing.

    Returns:

      OGRERR_NONE on success.

  OGRErr SetHOMAC(double dfCenterLat, double dfCenterLong, double dfAzimuth, double dfRectToSkew, double dfScale, double dfFalseEasting, double dfFalseNorthing)

    Hotine Oblique Mercator Azimuth Center / Variant B.

    Set an Hotine Oblique Mercator Azimuth Center projection using azimuth angle.

    This projection corresponds to EPSG projection method 9815, also sometimes known as hotine oblique mercator (variant B).

    This method does the same thing as the C function OSRSetHOMAC().

    Parameters:

      - dfCenterLat -- Latitude of the projection origin.

      - dfCenterLong -- Longitude of the projection origin.

      - dfAzimuth -- Azimuth, measured clockwise from North, of the projection centerline.

      - dfRectToSkew -- Angle from Rectified to Skew Grid

      - dfScale -- Scale factor applies to the projection origin.

      - dfFalseEasting -- False easting.

      - dfFalseNorthing -- False northing.

    Returns:

      OGRERR_NONE on success.

  OGRErr SetLOM(double dfCenterLat, double dfCenterLong, double dfAzimuth, double dfScale, double dfFalseEasting, double dfFalseNorthing)

    Laborde Oblique Mercator.

    Set a Laborde Oblique Mercator projection.

    Parameters:

      - dfCenterLat -- Latitude of the projection origin.

      - dfCenterLong -- Longitude of the projection origin.

      - dfAzimuth -- Azimuth, measured clockwise from North, of the projection centerline.

      - dfScale -- Scale factor on the initial line

      - dfFalseEasting -- False easting.

      - dfFalseNorthing -- False northing.

    Returns:

      OGRERR_NONE on success.

  OGRErr SetIWMPolyconic(double dfLat1, double dfLat2, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

    International Map of the World Polyconic.

  OGRErr SetKrovak(double dfCenterLat, double dfCenterLong, double dfAzimuth, double dfPseudoStdParallelLat, double dfScale, double dfFalseEasting, double dfFalseNorthing)

    Krovak Oblique Conic Conformal.

    Krovak east-north projection.

    Note that dfAzimuth and dfPseudoStdParallel1 are ignored when exporting to PROJ and should be respectively set to 30.28813972222222 and 78.5

  OGRErr SetLAEA(double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

    Lambert Azimuthal Equal-Area.

  OGRErr SetLCC(double dfStdP1, double dfStdP2, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

    Lambert Conformal Conic.

  OGRErr SetLCC1SP(double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)

    Lambert Conformal Conic 1SP.

  OGRErr SetLCCB(double dfStdP1, double dfStdP2, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

    Lambert Conformal Conic (Belgium)

  OGRErr SetMC(double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

    Miller Cylindrical.

  OGRErr SetMercator(double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)

    Mercator 1SP.

  OGRErr SetMercator2SP(double dfStdP1, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

    Mercator 2SP.

  OGRErr SetMollweide(double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)

    Mollweide.

  OGRErr SetNZMG(double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

    New Zealand Map Grid.

  OGRErr SetOS(double dfOriginLat, double dfCMeridian, double dfScale, double dfFalseEasting, double dfFalseNorthing)

    Oblique Stereographic.

  OGRErr SetOrthographic(double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

    Orthographic.

  OGRErr SetPolyconic(double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

    Polyconic.

  OGRErr SetPS(double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)

    Polar Stereographic.

    Sets a Polar Stereographic projection.

    Two variants are possible:

    - Polar Stereographic Variant A: dfCenterLat must be +/- 90° and is interpreted as the latitude of origin, combined with the scale factor

    - Polar Stereographic Variant B: dfCenterLat is different from +/- 90° and is interpreted as the latitude of true scale. In that situation, dfScale must be set to 1 (it is ignored in the projection parameters)

  OGRErr SetRobinson(double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

    Robinson.

  OGRErr SetSinusoidal(double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

    Sinusoidal.

  OGRErr SetStereographic(double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)

    Stereographic.

  OGRErr SetSOC(double dfLatitudeOfOrigin, double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)

    Swiss Oblique Cylindrical.

  OGRErr SetTM(double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)

    Transverse Mercator.

  OGRErr SetTMVariant(const char *pszVariantName, double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)

    Transverse Mercator variants.

  OGRErr SetTMG(double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

    Tunesia Mining Grid

  OGRErr SetTMSO(double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)

    Transverse Mercator (South Oriented)

  OGRErr SetTPED(double dfLat1, double dfLong1, double dfLat2, double dfLong2, double dfFalseEasting, double dfFalseNorthing)

    Two Point Equidistant.

  OGRErr SetVDG(double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

    VanDerGrinten.

  OGRErr SetUTM(int nZone, int bNorth = TRUE)

    Universal Transverse Mercator.

    Set UTM projection definition.

    This will generate a projection definition with the full set of transverse mercator projection parameters for the given UTM zone. If no PROJCS[] description is set yet, one will be set to look like "UTM Zone %d, {Northern, Southern} Hemisphere".

    This method is the same as the C function OSRSetUTM().

    Parameters:

      - nZone -- UTM zone.

      - bNorth -- TRUE for northern hemisphere, or FALSE for southern hemisphere.

    Returns:

      OGRERR_NONE on success.

  int GetUTMZone(int *pbNorth = nullptr) const

    Get utm zone information.

    This is the same as the C function OSRGetUTMZone().

    In SWIG bindings (Python, Java, etc) the GetUTMZone() method returns a zone which is negative in the southern hemisphere instead of having the pbNorth flag used in the C and C++ interface.

    Parameters:

      pbNorth -- pointer to in to set to TRUE if northern hemisphere, or FALSE if southern.

    Returns:

      UTM zone number or zero if this isn't a UTM definition.

  OGRErr SetWagner(int nVariation, double dfCenterLat, double dfFalseEasting, double dfFalseNorthing)

    Wagner I -- VII.

  OGRErr SetQSC(double dfCenterLat, double dfCenterLong)

    Quadrilateralized Spherical Cube.

  OGRErr SetSCH(double dfPegLat, double dfPegLong, double dfPegHeading, double dfPegHgt)

    Spherical, Cross-track, Height.

  OGRErr SetVerticalPerspective(double dfTopoOriginLat, double dfTopoOriginLon, double dfTopoOriginHeight, double dfViewPointHeight, double dfFalseEasting, double dfFalseNorthing)

    Vertical Perspective / Near-sided Perspective.

  OGRErr SetDerivedGeogCRSWithPoleRotationGRIBConvention(const char *pszCRSName, double dfSouthPoleLat, double dfSouthPoleLon, double dfAxisRotation)

    Pole rotation (GRIB convention)

  OGRErr SetDerivedGeogCRSWithPoleRotationNetCDFCFConvention(const char *pszCRSName, double dfGridNorthPoleLat, double dfGridNorthPoleLon, double dfNorthPoleGridLon)

    Pole rotation (netCDF CF convention)

  OGRErr SetStatePlane(int nZone, int bNAD83 = TRUE, const char *pszOverrideUnitName = nullptr, double dfOverrideUnit = 0.0)

    State Plane.

    Set State Plane projection definition.

    This will attempt to generate a complete definition of a state plane zone based on generating the entire SRS from the EPSG tables. If the EPSG tables are unavailable, it will produce a stubbed LOCAL_CS definition and return OGRERR_FAILURE.

    This method is the same as the C function OSRSetStatePlaneWithUnits().

    Parameters:

      - nZone -- State plane zone number, in the USGS numbering scheme (as distinct from the Arc/Info and Erdas numbering scheme.

      - bNAD83 -- TRUE if the NAD83 zone definition should be used or FALSE if the NAD27 zone definition should be used.

      - pszOverrideUnitName -- Linear unit name to apply overriding the legal definition for this zone.

      - dfOverrideUnit -- Linear unit conversion factor to apply overriding the legal definition for this zone.

    Returns:

      OGRERR_NONE on success, or OGRERR_FAILURE on failure, mostly likely due to the EPSG tables not being accessible.

  OGRErr ImportFromESRIStatePlaneWKT(int nCode, const char *pszDatumName, const char *pszUnitsName, int nPCSCode, const char *pszCRSName = nullptr)

    ImportFromESRIStatePlaneWKT.

  OGRErr ImportFromESRIWisconsinWKT(const char *pszPrjName, double dfCentralMeridian, double dfLatOfOrigin, const char *pszUnitsName, const char *pszCRSName = nullptr)

    ImportFromESRIWisconsinWKT.

  Public Static Functions

  static void DestroySpatialReference(OGRSpatialReference *poSRS)

    OGRSpatialReference destructor.

    This static method will destroy a OGRSpatialReference. It is equivalent to calling delete on the object, but it ensures that the deallocation is properly executed within the OGR libraries heap on platforms where this can matter (win32).

    This function is the same as OSRDestroySpatialReference()

    Parameters:

      poSRS -- the object to delete

  static CSLConstList SET_FROM_USER_INPUT_LIMITATIONS_get()

    Return OGRSpatialReference::SET_FROM_USER_INPUT_LIMITATIONS.

  static int IsAngularParameter(const char*)

    Is the passed projection parameter an angular one?

    Returns:

      TRUE or FALSE

  static int IsLongitudeParameter(const char*)

    Is the passed projection parameter an angular longitude (relative to a prime meridian)?

    Returns:

      TRUE or FALSE

  static int IsLinearParameter(const char*)

    Is the passed projection parameter an linear one measured in meters or some similar linear measure.

    Returns:

      TRUE or FALSE

  static OGRSpatialReference *GetWGS84SRS()

    Returns an instance of a SRS object with WGS84 WKT.

    Note: the instance will have SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER)

    The reference counter of the returned object is not increased by this operation.

    Returns:

      instance.

  static inline OGRSpatialReferenceH ToHandle(OGRSpatialReference *poSRS)

    Convert a OGRSpatialReference* to a OGRSpatialReferenceH.

  static inline OGRSpatialReference *FromHandle(OGRSpatialReferenceH hSRS)

    Convert a OGRSpatialReferenceH to a OGRSpatialReference*.

  Public Static Attributes

  static const char *const SET_FROM_USER_INPUT_LIMITATIONS[] = {"ALLOW_NETWORK_ACCESS=NO", "ALLOW_FILE_ACCESS=NO", nullptr}

    Limitations for OGRSpatialReference::SetFromUserInput().

    Currently ALLOW_NETWORK_ACCESS=NO and ALLOW_FILE_ACCESS=NO.

  Private Functions

  void GetNormInfo() const

    Set the internal information for normalizing linear, and angular values.

  OGRErr importFromURNPart(const char *pszAuthority, const char *pszCode, const char *pszURN)
  OGRErr GetWKT2ProjectionMethod(const char **ppszMethodName, const char **ppszMethodAuthName = nullptr, const char **ppszMethodCode = nullptr) const

    Returns info on the projection method, based on WKT2 naming conventions.

    The returned strings are short lived and should be considered to be invalidated by any further call to the GDAL API.

    Parameters:

      - ppszMethodName -- [out] Pointer to a string that will receive the projection method name.

      - ppszMethodAuthName -- [out] null pointer, or pointer to a string that will receive the name of the authority that defines the projection method. *ppszMethodAuthName may be nullptr if the projection method is not linked to an authority.

      - ppszMethodCode -- [out] null pointer, or pointer to a string that will receive the code that defines the projection method. *ppszMethodCode may be nullptr if the projection method is not linked to an authority.

    Returns:

      OGRERR_NONE on success.

  Private Members

  std::unique_ptr<Private> d

  Private Static Functions

  static CPLString lookupInDict(const char *pszDictFile, const char *pszCode)

class OGRCoordinateTransformation
  #include <ogr_spatialref.h>

  Interface for transforming between coordinate systems.

  Currently, the only implementation within OGR is OGRProjCT, which requires the PROJ library.

  Also, see OGRCreateCoordinateTransformation() for creating transformations.

  Subclassed by AxisMappingCoordinateTransformation, CompositeCT, CutlineTransformer, GCPCoordTransformation, GeoTransformCoordinateTransformation

  Public Functions

  virtual ~OGRCoordinateTransformation()
  virtual const OGRSpatialReference *GetSourceCS() const = 0

    Fetch internal source coordinate system.

  virtual const OGRSpatialReference *GetTargetCS() const = 0

    Fetch internal target coordinate system.

  inline virtual bool GetEmitErrors() const

    Whether the transformer will emit CPLError.

  inline virtual void SetEmitErrors(bool)

    Set if the transformer must emit CPLError.

  int Transform(size_t nCount, double *x, double *y, double *z = nullptr, int *pabSuccess = nullptr)

    Transform points from source to destination space.

    This method is the same as the C function OCTTransformEx().

    Parameters:

      - nCount -- number of points to transform (`size_t` type since 3.9, `int` in previous versions).

      - x -- array of nCount X vertices, modified in place. Should not be NULL.

      - y -- array of nCount Y vertices, modified in place. Should not be NULL.

      - z -- array of nCount Z vertices, modified in place. Might be NULL.

      - pabSuccess -- array of per-point flags set to TRUE if that point transforms, or FALSE if it does not. Might be NULL.

    Returns:

      TRUE on success, or FALSE if some or all points fail to transform. When FALSE is returned the pabSuccess[] array indicates which points succeeded or failed to transform. When TRUE is returned, all values in pabSuccess[] are set to true.

  virtual int Transform(size_t nCount, double *x, double *y, double *z, double *t, int *pabSuccess) = 0

    Transform points from source to destination space.

    This method is the same as the C function OCTTransform4D().

    Parameters:

      - nCount -- number of points to transform (`size_t` type since 3.9, `int` in previous versions).

      - x -- array of nCount X vertices, modified in place. Should not be NULL.

      - y -- array of nCount Y vertices, modified in place. Should not be NULL.

      - z -- array of nCount Z vertices, modified in place. Might be NULL.

      - t -- array of nCount time values, modified in place. Might be NULL.

      - pabSuccess -- array of per-point flags set to TRUE if that point transforms, or FALSE if it does not. Might be NULL.

    Returns:

      TRUE on success, or FALSE if some or all points fail to transform. When FALSE is returned the pabSuccess[] array indicates which points succeeded or failed to transform. When TRUE is returned, all values in pabSuccess[] are set to true. Caution: prior to GDAL 3.11, TRUE could be returned if a transformation could be found but not all points may have necessarily succeed to transform.

  virtual int TransformWithErrorCodes(size_t nCount, double *x, double *y, double *z, double *t, int *panErrorCodes)

    Transform points from source to destination space.

    This method is the same as the C function OCTTransform4DWithErrorCodes().

    Since

      GDAL 3.3, and PROJ 8 to be able to use PROJ public error codes

    Parameters:

      - nCount -- number of points to transform (`size_t` type since 3.9, `int` in previous versions).

      - x -- array of nCount X vertices, modified in place. Should not be NULL.

      - y -- array of nCount Y vertices, modified in place. Should not be NULL.

      - z -- array of nCount Z vertices, modified in place. Might be NULL.

      - t -- array of nCount time values, modified in place. Might be NULL.

      - panErrorCodes -- Output array of nCount value that will be set to 0 for success, or a non-zero value for failure. Refer to PROJ 8 public error codes. Might be NULL

    Returns:

      TRUE on success, or FALSE if some or all points fail to transform. When FALSE is returned the panErrorCodes[] array indicates which points succeeded or failed to transform. When TRUE is returned, all values in panErrorCodes[] are set to zero. Caution: prior to GDAL 3.11, TRUE could be returned if a transformation could be found but not all points may have necessarily succeed to transform.

  inline virtual int TransformBounds(const double xmin, const double ymin, const double xmax, const double ymax, double *out_xmin, double *out_ymin, double *out_xmax, double *out_ymax, const int densify_pts)

    Transform boundary.

    This method is the same as the C function OCTTransformBounds().

    Transform boundary densifying the edges to account for nonlinear transformations along these edges and extracting the outermost bounds.

    If the destination CRS is geographic, the first axis is longitude, and xmax < xmin then the bounds crossed the antimeridian. In this scenario there are two polygons, one on each side of the antimeridian. The first polygon should be constructed with (xmin, ymin, 180, ymax) and the second with (-180, ymin, xmax, ymax).

    If the destination CRS is geographic, the first axis is latitude, and ymax < ymin then the bounds crossed the antimeridian. In this scenario there are two polygons, one on each side of the antimeridian. The first polygon should be constructed with (ymin, xmin, ymax, 180) and the second with (ymin, -180, ymax, xmax).

    Since

      3.4

    Parameters:

      - xmin -- Minimum bounding coordinate of the first axis in source CRS.

      - ymin -- Minimum bounding coordinate of the second axis in source CRS.

      - xmax -- Maximum bounding coordinate of the first axis in source CRS.

      - ymax -- Maximum bounding coordinate of the second axis in source CRS.

      - out_xmin -- Minimum bounding coordinate of the first axis in target CRS

      - out_ymin -- Minimum bounding coordinate of the second axis in target CRS.

      - out_xmax -- Maximum bounding coordinate of the first axis in target CRS.

      - out_ymax -- Maximum bounding coordinate of the second axis in target CRS.

      - densify_pts -- Recommended to use 21. This is the number of points to use to densify the bounding polygon in the transformation.

    Returns:

      TRUE if successful. FALSE if failures encountered.

  virtual OGRCoordinateTransformation *Clone() const = 0

    Clone.

    Since

      GDAL 3.1

  virtual OGRCoordinateTransformation *GetInverse() const = 0

    Return a coordinate transformation that performs the inverse transformation of the current one.

    In some cases, this is not possible, and this method might return nullptr, or fail to perform the transformations.

    Since

      GDAL 3.3

    Returns:

      the new coordinate transformation, or nullptr in case of error.

  Public Static Functions

  static void DestroyCT(OGRCoordinateTransformation *poCT)

    OGRCoordinateTransformation destructor.

    This function is the same as OGRCoordinateTransformation::~OGRCoordinateTransformation() and OCTDestroyCoordinateTransformation()

    This static method will destroy a OGRCoordinateTransformation. It is equivalent to calling delete on the object, but it ensures that the deallocation is properly executed within the OGR libraries heap on platforms where this can matter (win32).

    Parameters:

      poCT -- the object to delete

  static inline OGRCoordinateTransformationH ToHandle(OGRCoordinateTransformation *poCT)

    Convert a OGRCoordinateTransformation* to a OGRCoordinateTransformationH.

  static inline OGRCoordinateTransformation *FromHandle(OGRCoordinateTransformationH hCT)

    Convert a OGRCoordinateTransformationH to a OGRCoordinateTransformation*.

struct OGRCoordinateTransformationOptions
  #include <ogr_spatialref.h>

  Context for coordinate transformation.

  Since

    GDAL 3.0

  Public Functions

  OGRCoordinateTransformationOptions()

    Constructs a new OGRCoordinateTransformationOptions.

    Since

      GDAL 3.0

  OGRCoordinateTransformationOptions(const OGRCoordinateTransformationOptions&)

    Copy constructor.

    Since

      GDAL 3.1

  OGRCoordinateTransformationOptions &operator=(const OGRCoordinateTransformationOptions&)

    Assignment operator.

    Since

      GDAL 3.1

  ~OGRCoordinateTransformationOptions()

    Destroys a OGRCoordinateTransformationOptions.

    Since

      GDAL 3.0

  bool SetAreaOfInterest(double dfWestLongitudeDeg, double dfSouthLatitudeDeg, double dfEastLongitudeDeg, double dfNorthLatitudeDeg)

    Sets an area of interest.

    The west longitude is generally lower than the east longitude, except for areas of interest that go across the anti-meridian.

    Since

      GDAL 3.0

    Parameters:

      - dfWestLongitudeDeg -- West longitude (in degree). Must be in [-180,180]

      - dfSouthLatitudeDeg -- South latitude (in degree). Must be in [-90,90]

      - dfEastLongitudeDeg -- East longitude (in degree). Must be in [-180,180]

      - dfNorthLatitudeDeg -- North latitude (in degree). Must be in [-90,90]

    Returns:

      true in case of success.

  bool SetDesiredAccuracy(double dfAccuracy)

    Sets the desired accuracy for coordinate operations.

    Only coordinate operations that offer an accuracy of at least the one specified will be considered.

    An accuracy of 0 is valid and means a coordinate operation made only of one or several conversions (map projections, unit conversion, etc.) Operations involving ballpark transformations have a unknown accuracy, and will be filtered out by any dfAccuracy >= 0 value.

    If this option is specified with PROJ < 8, the OGR_CT_OP_SELECTION configuration option will default to BEST_ACCURACY.

    Since

      GDAL 3.3

    Parameters:

      dfAccuracy -- accuracy in meters (or a negative value to disable this filter)

  bool SetBallparkAllowed(bool bAllowBallpark)

    Sets whether ballpark transformations are allowed.

    By default, PROJ may generate "ballpark transformations" (see https://proj.org/glossary.html) when precise datum transformations are missing. For high accuracy use cases, such transformations might not be allowed.

    If this option is specified with PROJ < 8, the OGR_CT_OP_SELECTION configuration option will default to BEST_ACCURACY.

    Since

      GDAL 3.3

    Parameters:

      bAllowBallpark -- false to disable the user of ballpark transformations

  bool SetOnlyBest(bool bOnlyBest)

    Sets whether only the "best" operation should be used.

    By default (at least in the PROJ 9.x series), PROJ may use coordinate operations that are not the "best" if resources (typically grids) needed to use them are missing. It will then fallback to other coordinate operations that have a lesser accuracy, for example using Helmert transformations, or in the absence of such operations, to ones with potential very rough accuracy, using "ballpark" transformations (see https://proj.org/glossary.html).

    When calling this method with bOnlyBest = true, PROJ will only consider the "best" operation, and error out (at Transform() time) if they cannot be used. This method may be used together with SetBallparkAllowed(false) to only allow best operations that have a known accuracy.

    Note that this method has no effect on PROJ versions before 9.2.

    The default value for this option can be also set with the PROJ_ONLY_BEST_DEFAULT environment variable, or with the "only_best_default" setting of proj.ini. Calling SetOnlyBest() overrides such default value.

    Since

      GDAL 3.8 and PROJ 9.2

    Parameters:

      bOnlyBest -- set to true to ask PROJ to use only the best operation(s)

  bool SetCoordinateOperation(const char *pszCT, bool bReverseCT)

    Sets a coordinate operation.

    This is a user override to be used instead of the normally computed pipeline.

    The pipeline must take into account the axis order of the source and target SRS.

    The pipeline may be provided as a PROJ string (single step operation or multiple step string starting with +proj=pipeline), a WKT2 string describing a CoordinateOperation, or a "urn:ogc:def:coordinateOperation:EPSG::XXXX" URN

    Since

      GDAL 3.0

    Parameters:

      - pszCO -- PROJ or WKT string describing a coordinate operation

      - bReverseCO -- Whether the PROJ or WKT string should be evaluated in the reverse path

    Returns:

      true in case of success.