crs namespace

namespace crs

CRS (coordinate reference system = coordinate system with a datum).

osgeo.proj.crs namespace

Typedefs

typedef std::shared_ptr<CRS> CRSPtr

Shared pointer of CRS

typedef util::nn<CRSPtr> CRSNNPtr

Non-null shared pointer of CRS

typedef std::shared_ptr<GeographicCRS> GeographicCRSPtr

Shared pointer of GeographicCRS

typedef util::nn<GeographicCRSPtr> GeographicCRSNNPtr

Non-null shared pointer of GeographicCRS

typedef std::shared_ptr<VerticalCRS> VerticalCRSPtr

Shared pointer of VerticalCRS

typedef util::nn<VerticalCRSPtr> VerticalCRSNNPtr

Non-null shared pointer of VerticalCRS

using BoundCRSPtr = std::shared_ptr<BoundCRS>

Shared pointer of BoundCRS

using BoundCRSNNPtr = util::nn<BoundCRSPtr>

Non-null shared pointer of BoundCRS

typedef std::shared_ptr<CompoundCRS> CompoundCRSPtr

Shared pointer of CompoundCRS

typedef util::nn<CompoundCRSPtr> CompoundCRSNNPtr

Non-null shared pointer of CompoundCRS

using SingleCRSPtr = std::shared_ptr<SingleCRS>

Shared pointer of SingleCRS

using SingleCRSNNPtr = util::nn<SingleCRSPtr>

Non-null shared pointer of SingleCRS

typedef std::shared_ptr<GeodeticCRS> GeodeticCRSPtr

Shared pointer of GeodeticCRS

typedef util::nn<GeodeticCRSPtr> GeodeticCRSNNPtr

Non-null shared pointer of GeodeticCRS

using DerivedCRSPtr = std::shared_ptr<DerivedCRS>

Shared pointer of DerivedCRS

using DerivedCRSNNPtr = util::nn<DerivedCRSPtr>

Non-null shared pointer of DerivedCRS

typedef std::shared_ptr<ProjectedCRS> ProjectedCRSPtr

Shared pointer of ProjectedCRS

typedef util::nn<ProjectedCRSPtr> ProjectedCRSNNPtr

Non-null shared pointer of ProjectedCRS

using TemporalCRSPtr = std::shared_ptr<TemporalCRS>

Shared pointer of TemporalCRS

using TemporalCRSNNPtr = util::nn<TemporalCRSPtr>

Non-null shared pointer of TemporalCRS

using EngineeringCRSPtr = std::shared_ptr<EngineeringCRS>

Shared pointer of EngineeringCRS

using EngineeringCRSNNPtr = util::nn<EngineeringCRSPtr>

Non-null shared pointer of EngineeringCRS

using ParametricCRSPtr = std::shared_ptr<ParametricCRS>

Shared pointer of ParametricCRS

using ParametricCRSNNPtr = util::nn<ParametricCRSPtr>

Non-null shared pointer of ParametricCRS

using DerivedGeodeticCRSPtr = std::shared_ptr<DerivedGeodeticCRS>

Shared pointer of DerivedGeodeticCRS

using DerivedGeodeticCRSNNPtr = util::nn<DerivedGeodeticCRSPtr>

Non-null shared pointer of DerivedGeodeticCRS

using DerivedGeographicCRSPtr = std::shared_ptr<DerivedGeographicCRS>

Shared pointer of DerivedGeographicCRS

using DerivedGeographicCRSNNPtr = util::nn<DerivedGeographicCRSPtr>

Non-null shared pointer of DerivedGeographicCRS

using DerivedProjectedCRSPtr = std::shared_ptr<DerivedProjectedCRS>

Shared pointer of DerivedProjectedCRS

using DerivedProjectedCRSNNPtr = util::nn<DerivedProjectedCRSPtr>

Non-null shared pointer of DerivedProjectedCRS

using DerivedVerticalCRSPtr = std::shared_ptr<DerivedVerticalCRS>

Shared pointer of DerivedVerticalCRS

using DerivedVerticalCRSNNPtr = util::nn<DerivedVerticalCRSPtr>

Non-null shared pointer of DerivedVerticalCRS

using DerivedEngineeringCRSPtr = std::shared_ptr<DerivedEngineeringCRS>

Shared pointer of DerivedEngineeringCRS

using DerivedEngineeringCRSNNPtr = util::nn<DerivedEngineeringCRSPtr>

Non-null shared pointer of DerivedEngineeringCRS

using DerivedParametricCRSPtr = std::shared_ptr<DerivedParametricCRS>

Shared pointer of DerivedParametricCRS

using DerivedParametricCRSNNPtr = util::nn<DerivedParametricCRSPtr>

Non-null shared pointer of DerivedParametricCRS

using DerivedTemporalCRSPtr = std::shared_ptr<DerivedTemporalCRS>

Shared pointer of DerivedTemporalCRS

using DerivedTemporalCRSNNPtr = util::nn<DerivedTemporalCRSPtr>

Non-null shared pointer of DerivedTemporalCRS

class CRS : public osgeo::proj::common::ObjectUsage, public osgeo::proj::io::IJSONExportable
#include <crs.hpp>

Abstract class modelling a coordinate reference system which is usually single but may be compound.

Remark

Implements CRS from ISO 19111:2019

Subclassed by osgeo::proj::crs::BoundCRS, osgeo::proj::crs::CompoundCRS, osgeo::proj::crs::SingleCRS

Public Functions

bool isDynamic(bool considerWGS84AsDynamic = false) const

Return whether a CRS is a dynamic CRS.

A dynamic CRS is a CRS that contains a geodetic CRS whose geodetic reference frame is dynamic, or a vertical CRS whose vertical reference frame is dynamic.

Since

9.2

Parameters:

considerWGS84AsDynamic -- set to true to consider the WGS 84 / EPSG:6326 datum ensemble as dynamic.

GeodeticCRSPtr extractGeodeticCRS() const

Return the GeodeticCRS of the CRS.

Returns the GeodeticCRS contained in a CRS. This works currently with input parameters of type GeodeticCRS or derived, ProjectedCRS, CompoundCRS or BoundCRS.

Returns:

a GeodeticCRSPtr, that might be null.

GeographicCRSPtr extractGeographicCRS() const

Return the GeographicCRS of the CRS.

Returns the GeographicCRS contained in a CRS. This works currently with input parameters of type GeographicCRS or derived, ProjectedCRS, CompoundCRS or BoundCRS.

Returns:

a GeographicCRSPtr, that might be null.

VerticalCRSPtr extractVerticalCRS() const

Return the VerticalCRS of the CRS.

Returns the VerticalCRS contained in a CRS. This works currently with input parameters of type VerticalCRS or derived, CompoundCRS or BoundCRS.

Returns:

a VerticalCRSPtr, that might be null.

CRSNNPtr createBoundCRSToWGS84IfPossible(const io::DatabaseContextPtr &dbContext, operation::CoordinateOperationContext::IntermediateCRSUse allowIntermediateCRSUse) const

Returns potentially a BoundCRS, with a transformation to EPSG:4326, wrapping this CRS.

If no such BoundCRS is possible, the object will be returned.

The purpose of this method is to be able to format a PROJ.4 string with a +towgs84 parameter or a WKT1:GDAL string with a TOWGS node.

This method will fetch the GeographicCRS of this CRS and find a transformation to EPSG:4326 using the domain of the validity of the main CRS, and there's only one Helmert transformation.

Returns:

a CRS.

CRSNNPtr stripVerticalComponent() const

Returns a CRS whose coordinate system does not contain a vertical component.

Returns:

a CRS.

const BoundCRSPtr &canonicalBoundCRS()

Return the BoundCRS potentially attached to this CRS.

In the case this method is called on a object returned by BoundCRS::baseCRSWithCanonicalBoundCRS(), this method will return this BoundCRS

Returns:

a BoundCRSPtr, that might be null.

std::list<std::pair<CRSNNPtr, int>> identify(const io::AuthorityFactoryPtr &authorityFactory) const

Identify the CRS with reference CRSs.

The candidate CRSs are either hard-coded, or looked in the database when authorityFactory is not null.

Note that the implementation uses a set of heuristics to have a good compromise of successful identifications over execution time. It might miss legitimate matches in some circumstances.

The method returns a list of matching reference CRS, and the percentage (0-100) of confidence in the match. The list is sorted by decreasing confidence.

  • 100% means that the name of the reference entry perfectly matches the CRS name, and both are equivalent. In which case a single result is returned. Note: in the case of a GeographicCRS whose axis order is implicit in the input definition (for example ESRI WKT), then axis order is ignored for the purpose of identification. That is the CRS built from GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]], PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]] will be identified to EPSG:4326, but will not pass a isEquivalentTo(EPSG_4326, util::IComparable::Criterion::EQUIVALENT) test, but rather isEquivalentTo(EPSG_4326, util::IComparable::Criterion::EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS)

  • 90% means that CRS are equivalent, but the names are not exactly the same.

  • 70% means that CRS are equivalent), but the names do not match at all.

  • 25% means that the CRS are not equivalent, but there is some similarity in the names.

Other confidence values may be returned by some specialized implementations.

This is implemented for GeodeticCRS, ProjectedCRS, VerticalCRS and CompoundCRS.

Parameters:

authorityFactory -- Authority factory (or null, but degraded functionality)

Returns:

a list of matching reference CRS, and the percentage (0-100) of confidence in the match.

std::list<CRSNNPtr> getNonDeprecated(const io::DatabaseContextNNPtr &dbContext) const

Return CRSs that are non-deprecated substitutes for the current CRS.

CRSNNPtr promoteTo3D(const std::string &newName, const io::DatabaseContextPtr &dbContext) const

Return a variant of this CRS "promoted" to a 3D one, if not already the case.

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

Since

6.3

Parameters:
  • newName -- Name of the new CRS. If empty, nameStr() will be used.

  • dbContext -- Database context to look for potentially already registered 3D CRS. May be nullptr.

Returns:

a new CRS promoted to 3D, or the current one if already 3D or not applicable.

CRSNNPtr demoteTo2D(const std::string &newName, const io::DatabaseContextPtr &dbContext) const

Return a variant of this CRS "demoted" to a 2D one, if not already the case.

Since

6.3

Parameters:
  • newName -- Name of the new CRS. If empty, nameStr() will be used.

  • dbContext -- Database context to look for potentially already registered 2D CRS. May be nullptr.

Returns:

a new CRS demoted to 2D, or the current one if already 2D or not applicable.

class SingleCRS : public osgeo::proj::crs::CRS
#include <crs.hpp>

Abstract class modelling a coordinate reference system consisting of one Coordinate System and either one datum::Datum or one datum::DatumEnsemble.

Remark

Implements SingleCRS from ISO 19111:2019

Subclassed by osgeo::proj::crs::DerivedCRS, osgeo::proj::crs::EngineeringCRS, osgeo::proj::crs::GeodeticCRS, osgeo::proj::crs::ParametricCRS, osgeo::proj::crs::TemporalCRS, osgeo::proj::crs::VerticalCRS

Public Functions

const datum::DatumPtr &datum()

Return the datum::Datum associated with the CRS.

This might be null, in which case datumEnsemble() return will not be null.

Returns:

a Datum that might be null.

const datum::DatumEnsemblePtr &datumEnsemble()

Return the datum::DatumEnsemble associated with the CRS.

This might be null, in which case datum() return will not be null.

Returns:

a DatumEnsemble that might be null.

const cs::CoordinateSystemNNPtr &coordinateSystem()

Return the cs::CoordinateSystem associated with the CRS.

Returns:

a CoordinateSystem.

class GeodeticCRS : public virtual osgeo::proj::crs::SingleCRS, public osgeo::proj::io::IPROJStringExportable
#include <crs.hpp>

A coordinate reference system associated with a geodetic reference frame and a three-dimensional Cartesian or spherical coordinate system.

If the geodetic reference frame is dynamic or if the geodetic CRS has an association to a velocity model then the geodetic CRS is dynamic, else it is static.

Remark

Implements GeodeticCRS from ISO 19111:2019

Subclassed by osgeo::proj::crs::DerivedGeodeticCRS, osgeo::proj::crs::GeographicCRS

Public Functions

const datum::GeodeticReferenceFramePtr &datum()

Return the datum::GeodeticReferenceFrame associated with the CRS.

Returns:

a GeodeticReferenceFrame or null (in which case datumEnsemble() should return a non-null pointer.)

const datum::PrimeMeridianNNPtr &primeMeridian()

Return the PrimeMeridian associated with the GeodeticReferenceFrame or with one of the GeodeticReferenceFrame of the datumEnsemble().

Returns:

the PrimeMeridian.

const datum::EllipsoidNNPtr &ellipsoid()

Return the ellipsoid associated with the GeodeticReferenceFrame or with one of the GeodeticReferenceFrame of the datumEnsemble().

Returns:

the PrimeMeridian.

const std::vector<operation::PointMotionOperationNNPtr> &velocityModel()

Return the velocity model associated with the CRS.

Returns:

a velocity model. might be null.

bool isGeocentric()

Return whether the CRS is a Cartesian geocentric one.

A geocentric CRS is a geodetic CRS that has a Cartesian coordinate system with three axis, whose direction is respectively cs::AxisDirection::GEOCENTRIC_X, cs::AxisDirection::GEOCENTRIC_Y and cs::AxisDirection::GEOCENTRIC_Z.

Returns:

true if the CRS is a geocentric CRS.

bool isSphericalPlanetocentric()

Return whether the CRS is a Spherical planetocentric one.

A Spherical planetocentric CRS is a geodetic CRS that has a spherical (angular) coordinate system with 2 axis, which represent geocentric latitude/ longitude or longitude/geocentric latitude.

Such CRS are typically used in use case that apply to non-Earth bodies.

Since

8.2

Returns:

true if the CRS is a Spherical planetocentric CRS.

std::list<std::pair<GeodeticCRSNNPtr, int>> identify(const io::AuthorityFactoryPtr &authorityFactory) const

Identify the CRS with reference CRSs.

The candidate CRSs are either hard-coded, or looked in the database when authorityFactory is not null.

Note that the implementation uses a set of heuristics to have a good compromise of successful identifications over execution time. It might miss legitimate matches in some circumstances.

The method returns a list of matching reference CRS, and the percentage (0-100) of confidence in the match:

  • 100% means that the name of the reference entry perfectly matches the CRS name, and both are equivalent. In which case a single result is returned. Note: in the case of a GeographicCRS whose axis order is implicit in the input definition (for example ESRI WKT), then axis order is ignored for the purpose of identification. That is the CRS built from GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]], PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]] will be identified to EPSG:4326, but will not pass a isEquivalentTo(EPSG_4326, util::IComparable::Criterion::EQUIVALENT) test, but rather isEquivalentTo(EPSG_4326, util::IComparable::Criterion::EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS)

  • 90% means that CRS are equivalent, but the names are not exactly the same.

  • 70% means that CRS are equivalent (equivalent datum and coordinate system), but the names are not equivalent.

  • 60% means that ellipsoid, prime meridian and coordinate systems are equivalent, but the CRS and datum names do not match.

  • 25% means that the CRS are not equivalent, but there is some similarity in the names.

Parameters:

authorityFactory -- Authority factory (or null, but degraded functionality)

Returns:

a list of matching reference CRS, and the percentage (0-100) of confidence in the match.

Public Static Functions

static GeodeticCRSNNPtr create(const util::PropertyMap &properties, const datum::GeodeticReferenceFrameNNPtr &datum, const cs::SphericalCSNNPtr &cs)

Instantiate a GeodeticCRS from a datum::GeodeticReferenceFrame and a cs::SphericalCS.

Parameters:
  • properties -- See General properties. At minimum the name should be defined.

  • datum -- The datum of the CRS.

  • cs -- a SphericalCS.

Returns:

new GeodeticCRS.

static GeodeticCRSNNPtr create(const util::PropertyMap &properties, const datum::GeodeticReferenceFrameNNPtr &datum, const cs::CartesianCSNNPtr &cs)

Instantiate a GeodeticCRS from a datum::GeodeticReferenceFrame and a cs::CartesianCS.

Parameters:
  • properties -- See General properties. At minimum the name should be defined.

  • datum -- The datum of the CRS.

  • cs -- a CartesianCS.

Returns:

new GeodeticCRS.

static GeodeticCRSNNPtr create(const util::PropertyMap &properties, const datum::GeodeticReferenceFramePtr &datum, const datum::DatumEnsemblePtr &datumEnsemble, const cs::SphericalCSNNPtr &cs)

Instantiate a GeodeticCRS from a datum::GeodeticReferenceFrame or datum::DatumEnsemble and a cs::SphericalCS.

One and only one of datum or datumEnsemble should be set to a non-null value.

Parameters:
  • properties -- See General properties. At minimum the name should be defined.

  • datum -- The datum of the CRS, or nullptr

  • datumEnsemble -- The datum ensemble of the CRS, or nullptr.

  • cs -- a SphericalCS.

Returns:

new GeodeticCRS.

static GeodeticCRSNNPtr create(const util::PropertyMap &properties, const datum::GeodeticReferenceFramePtr &datum, const datum::DatumEnsemblePtr &datumEnsemble, const cs::CartesianCSNNPtr &cs)

Instantiate a GeodeticCRS from a datum::GeodeticReferenceFrame or datum::DatumEnsemble and a cs::CartesianCS.

One and only one of datum or datumEnsemble should be set to a non-null value.

Parameters:
  • properties -- See General properties. At minimum the name should be defined.

  • datum -- The datum of the CRS, or nullptr

  • datumEnsemble -- The datum ensemble of the CRS, or nullptr.

  • cs -- a CartesianCS

Returns:

new GeodeticCRS.

Public Static Attributes

static const GeodeticCRSNNPtr EPSG_4978

EPSG:4978 / "WGS 84" Geocentric.

class GeographicCRS : public osgeo::proj::crs::GeodeticCRS
#include <crs.hpp>

A coordinate reference system associated with a geodetic reference frame and a two- or three-dimensional ellipsoidal coordinate system.

If the geodetic reference frame is dynamic or if the geographic CRS has an association to a velocity model then the geodetic CRS is dynamic, else it is static.

Remark

Implements GeographicCRS from ISO 19111:2019

Subclassed by osgeo::proj::crs::DerivedGeographicCRS

Public Functions

const cs::EllipsoidalCSNNPtr &coordinateSystem()

Return the cs::EllipsoidalCS associated with the CRS.

Returns:

a EllipsoidalCS.

GeographicCRSNNPtr demoteTo2D(const std::string &newName, const io::DatabaseContextPtr &dbContext) const

Return a variant of this CRS "demoted" to a 2D one, if not already the case.

Since

6.3

Parameters:
  • newName -- Name of the new CRS. If empty, nameStr() will be used.

  • dbContext -- Database context to look for potentially already registered 2D CRS. May be nullptr.

Returns:

a new CRS demoted to 2D, or the current one if already 2D or not applicable.

Public Static Functions

static GeographicCRSNNPtr create(const util::PropertyMap &properties, const datum::GeodeticReferenceFrameNNPtr &datum, const cs::EllipsoidalCSNNPtr &cs)

Instantiate a GeographicCRS from a datum::GeodeticReferenceFrameNNPtr and a cs::EllipsoidalCS.

Parameters:
  • properties -- See General properties. At minimum the name should be defined.

  • datum -- The datum of the CRS.

  • cs -- a EllipsoidalCS.

Returns:

new GeographicCRS.

static GeographicCRSNNPtr create(const util::PropertyMap &properties, const datum::GeodeticReferenceFramePtr &datum, const datum::DatumEnsemblePtr &datumEnsemble, const cs::EllipsoidalCSNNPtr &cs)

Instantiate a GeographicCRS from a datum::GeodeticReferenceFramePtr or datum::DatumEnsemble and a cs::EllipsoidalCS.

One and only one of datum or datumEnsemble should be set to a non-null value.

Parameters:
  • properties -- See General properties. At minimum the name should be defined.

  • datum -- The datum of the CRS, or nullptr

  • datumEnsemble -- The datum ensemble of the CRS, or nullptr.

  • cs -- a EllipsoidalCS.

Returns:

new GeographicCRS.

Public Static Attributes

static const GeographicCRSNNPtr EPSG_4267

EPSG:4267 / "NAD27" 2D GeographicCRS.

static const GeographicCRSNNPtr EPSG_4269

EPSG:4269 / "NAD83" 2D GeographicCRS.

static const GeographicCRSNNPtr EPSG_4326

EPSG:4326 / "WGS 84" 2D GeographicCRS.

static const GeographicCRSNNPtr OGC_CRS84

OGC:CRS84 / "CRS 84" 2D GeographicCRS (long, lat)

static const GeographicCRSNNPtr EPSG_4807

EPSG:4807 / "NTF (Paris)" 2D GeographicCRS.

static const GeographicCRSNNPtr EPSG_4979

EPSG:4979 / "WGS 84" 3D GeographicCRS.

class VerticalCRS : public virtual osgeo::proj::crs::SingleCRS, public osgeo::proj::io::IPROJStringExportable
#include <crs.hpp>

A coordinate reference system having a vertical reference frame and a one-dimensional vertical coordinate system used for recording gravity-related heights or depths.

Vertical CRSs make use of the direction of gravity to define the concept of height or depth, but the relationship with gravity may not be straightforward. If the vertical reference frame is dynamic or if the vertical CRS has an association to a velocity model then the CRS is dynamic, else it is static.

Remark

Implements VerticalCRS from ISO 19111:2019

Note

Ellipsoidal heights cannot be captured in a vertical coordinate reference system. They exist only as an inseparable part of a 3D coordinate tuple defined in a geographic 3D coordinate reference system.

Subclassed by osgeo::proj::crs::DerivedVerticalCRS

Public Functions

const datum::VerticalReferenceFramePtr datum() const

Return the datum::VerticalReferenceFrame associated with the CRS.

Returns:

a VerticalReferenceFrame.

const cs::VerticalCSNNPtr coordinateSystem() const

Return the cs::VerticalCS associated with the CRS.

Returns:

a VerticalCS.

const std::vector<operation::TransformationNNPtr> &geoidModel()

Return the geoid model associated with the CRS.

Geoid height model or height correction model linked to a geoid-based vertical CRS.

Returns:

a geoid model. might be null

const std::vector<operation::PointMotionOperationNNPtr> &velocityModel()

Return the velocity model associated with the CRS.

Returns:

a velocity model. might be null.

std::list<std::pair<VerticalCRSNNPtr, int>> identify(const io::AuthorityFactoryPtr &authorityFactory) const

Identify the CRS with reference CRSs.

The candidate CRSs are looked in the database when authorityFactory is not null.

Note that the implementation uses a set of heuristics to have a good compromise of successful identifications over execution time. It might miss legitimate matches in some circumstances.

The method returns a list of matching reference CRS, and the percentage (0-100) of confidence in the match. 100% means that the name of the reference entry perfectly matches the CRS name, and both are equivalent. In which case a single result is returned. 90% means that CRS are equivalent, but the names are not exactly the same. 70% means that CRS are equivalent (equivalent datum and coordinate system), but the names are not equivalent. 25% means that the CRS are not equivalent, but there is some similarity in the names.

Parameters:

authorityFactory -- Authority factory (if null, will return an empty list)

Returns:

a list of matching reference CRS, and the percentage (0-100) of confidence in the match.

Public Static Functions

static VerticalCRSNNPtr create(const util::PropertyMap &properties, const datum::VerticalReferenceFrameNNPtr &datumIn, const cs::VerticalCSNNPtr &csIn)

Instantiate a VerticalCRS from a datum::VerticalReferenceFrame and a cs::VerticalCS.

Parameters:
  • properties -- See General properties. At minimum the name should be defined. The GEOID_MODEL property can be set to a TransformationNNPtr object.

  • datumIn -- The datum of the CRS.

  • csIn -- a VerticalCS.

Returns:

new VerticalCRS.

static VerticalCRSNNPtr create(const util::PropertyMap &properties, const datum::VerticalReferenceFramePtr &datumIn, const datum::DatumEnsemblePtr &datumEnsembleIn, const cs::VerticalCSNNPtr &csIn)

Instantiate a VerticalCRS from a datum::VerticalReferenceFrame or datum::DatumEnsemble and a cs::VerticalCS.

One and only one of datum or datumEnsemble should be set to a non-null value.

Parameters:
  • properties -- See General properties. At minimum the name should be defined. The GEOID_MODEL property can be set to a TransformationNNPtr object.

  • datumIn -- The datum of the CRS, or nullptr

  • datumEnsembleIn -- The datum ensemble of the CRS, or nullptr.

  • csIn -- a VerticalCS.

Returns:

new VerticalCRS.

class DerivedCRS : public virtual osgeo::proj::crs::SingleCRS
#include <crs.hpp>

Abstract class modelling a single coordinate reference system that is defined through the application of a specified coordinate conversion to the definition of a previously established single coordinate reference system referred to as the base CRS.

A derived coordinate reference system inherits its datum (or datum ensemble) from its base CRS. The coordinate conversion between the base and derived coordinate reference system is implemented using the parameters and formula(s) specified in the definition of the coordinate conversion.

Remark

Implements DerivedCRS from ISO 19111:2019

Subclassed by osgeo::proj::crs::DerivedCRSTemplate< DerivedTemporalCRSTraits >, osgeo::proj::crs::DerivedCRSTemplate< DerivedParametricCRSTraits >, osgeo::proj::crs::DerivedCRSTemplate< DerivedEngineeringCRSTraits >, osgeo::proj::crs::DerivedCRSTemplate< DerivedCRSTraits >, osgeo::proj::crs::DerivedGeodeticCRS, osgeo::proj::crs::DerivedGeographicCRS, osgeo::proj::crs::DerivedProjectedCRS, osgeo::proj::crs::DerivedVerticalCRS, osgeo::proj::crs::ProjectedCRS

Public Functions

const SingleCRSNNPtr &baseCRS()

Return the base CRS of a DerivedCRS.

Returns:

the base CRS.

const operation::ConversionNNPtr derivingConversion() const

Return the deriving conversion from the base CRS to this CRS.

Returns:

the deriving conversion.

class ProjectedCRS : public osgeo::proj::crs::DerivedCRS, public osgeo::proj::io::IPROJStringExportable
#include <crs.hpp>

A derived coordinate reference system which has a geodetic (usually geographic) coordinate reference system as its base CRS, thereby inheriting a geodetic reference frame, and is converted using a map projection.

It has a Cartesian coordinate system, usually two-dimensional but may be three-dimensional; in the 3D case the base geographic CRSs ellipsoidal height is passed through unchanged and forms the vertical axis of the projected CRS's Cartesian coordinate system.

Remark

Implements ProjectedCRS from ISO 19111:2019

Public Functions

const GeodeticCRSNNPtr &baseCRS()

Return the base CRS (a GeodeticCRS, which is generally a GeographicCRS) of the ProjectedCRS.

Returns:

the base CRS.

const cs::CartesianCSNNPtr &coordinateSystem()

Return the cs::CartesianCS associated with the CRS.

Returns:

a CartesianCS

std::list<std::pair<ProjectedCRSNNPtr, int>> identify(const io::AuthorityFactoryPtr &authorityFactory) const

Identify the CRS with reference CRSs.

The candidate CRSs are either hard-coded, or looked in the database when authorityFactory is not null.

Note that the implementation uses a set of heuristics to have a good compromise of successful identifications over execution time. It might miss legitimate matches in some circumstances.

The method returns a list of matching reference CRS, and the percentage (0-100) of confidence in the match. The list is sorted by decreasing confidence.

100% means that the name of the reference entry perfectly matches the CRS name, and both are equivalent. In which case a single result is returned. 90% means that CRS are equivalent, but the names are not exactly the same. 70% means that CRS are equivalent (equivalent base CRS, conversion and coordinate system), but the names are not equivalent. 60% means that CRS have strong similarity (equivalent base datum, conversion and coordinate system), but the names are not equivalent. 50% means that CRS have similarity (equivalent base ellipsoid and conversion), but the coordinate system do not match (e.g. different axis ordering or axis unit). 25% means that the CRS are not equivalent, but there is some similarity in the names.

For the purpose of this function, equivalence is tested with the util::IComparable::Criterion::EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS, that is to say that the axis order of the base GeographicCRS is ignored.

Parameters:

authorityFactory -- Authority factory (or null, but degraded functionality)

Returns:

a list of matching reference CRS, and the percentage (0-100) of confidence in the match.

ProjectedCRSNNPtr demoteTo2D(const std::string &newName, const io::DatabaseContextPtr &dbContext) const

Return a variant of this CRS "demoted" to a 2D one, if not already the case.

Since

6.3

Parameters:
  • newName -- Name of the new CRS. If empty, nameStr() will be used.

  • dbContext -- Database context to look for potentially already registered 2D CRS. May be nullptr.

Returns:

a new CRS demoted to 2D, or the current one if already 2D or not applicable.

Public Static Functions

static ProjectedCRSNNPtr create(const util::PropertyMap &properties, const GeodeticCRSNNPtr &baseCRSIn, const operation::ConversionNNPtr &derivingConversionIn, const cs::CartesianCSNNPtr &csIn)

Instantiate a ProjectedCRS from a base CRS, a deriving operation::Conversion and a coordinate system.

Parameters:
Returns:

new ProjectedCRS.

class TemporalCRS : public virtual osgeo::proj::crs::SingleCRS
#include <crs.hpp>

A coordinate reference system associated with a temporal datum and a one-dimensional temporal coordinate system.

Remark

Implements TemporalCRS from ISO 19111:2019

Public Functions

const datum::TemporalDatumNNPtr datum() const

Return the datum::TemporalDatum associated with the CRS.

Returns:

a TemporalDatum

const cs::TemporalCSNNPtr coordinateSystem() const

Return the cs::TemporalCS associated with the CRS.

Returns:

a TemporalCS

Public Static Functions

static TemporalCRSNNPtr create(const util::PropertyMap &properties, const datum::TemporalDatumNNPtr &datumIn, const cs::TemporalCSNNPtr &csIn)

Instantiate a TemporalCRS from a datum and a coordinate system.

Parameters:
  • properties -- See General properties. At minimum the name should be defined.

  • datumIn -- the datum.

  • csIn -- the coordinate system.

Returns:

new TemporalCRS.

class EngineeringCRS : public virtual osgeo::proj::crs::SingleCRS
#include <crs.hpp>

Contextually local coordinate reference system associated with an engineering datum.

It is applied either to activities on or near the surface of the Earth without geodetic corrections, or on moving platforms such as road vehicles, vessels, aircraft or spacecraft, or as the internal CRS of an image.

In WKT2 standard, it maps to a ENGINEERINGCRS / ENGCRS keyword. In WKT1 specification, it maps to a LOCAL_CS keyword.

Remark

Implements EngineeringCRS from ISO 19111:2019

Public Functions

const datum::EngineeringDatumNNPtr datum() const

Return the datum::EngineeringDatum associated with the CRS.

Returns:

a EngineeringDatum

Public Static Functions

static EngineeringCRSNNPtr create(const util::PropertyMap &properties, const datum::EngineeringDatumNNPtr &datumIn, const cs::CoordinateSystemNNPtr &csIn)

Instantiate a EngineeringCRS from a datum and a coordinate system.

Parameters:
  • properties -- See General properties. At minimum the name should be defined.

  • datumIn -- the datum.

  • csIn -- the coordinate system.

Returns:

new EngineeringCRS.

class ParametricCRS : public virtual osgeo::proj::crs::SingleCRS
#include <crs.hpp>

Contextually local coordinate reference system associated with an engineering datum.

This is applied either to activities on or near the surface of the Earth without geodetic corrections, or on moving platforms such as road vehicles vessels, aircraft or spacecraft, or as the internal CRS of an image.

Remark

Implements ParametricCRS from ISO 19111:2019

Public Functions

const datum::ParametricDatumNNPtr datum() const

Return the datum::ParametricDatum associated with the CRS.

Returns:

a ParametricDatum

const cs::ParametricCSNNPtr coordinateSystem() const

Return the cs::TemporalCS associated with the CRS.

Returns:

a TemporalCS

Public Static Functions

static ParametricCRSNNPtr create(const util::PropertyMap &properties, const datum::ParametricDatumNNPtr &datumIn, const cs::ParametricCSNNPtr &csIn)

Instantiate a ParametricCRS from a datum and a coordinate system.

Parameters:
  • properties -- See General properties. At minimum the name should be defined.

  • datumIn -- the datum.

  • csIn -- the coordinate system.

Returns:

new ParametricCRS.

class InvalidCompoundCRSException : public osgeo::proj::util::Exception
#include <crs.hpp>

Exception thrown when attempting to create an invalid compound CRS.

class CompoundCRS : public osgeo::proj::crs::CRS, public osgeo::proj::io::IPROJStringExportable
#include <crs.hpp>

A coordinate reference system describing the position of points through two or more independent single coordinate reference systems.

Remark

Implements CompoundCRS from ISO 19111:2019

Note

Two coordinate reference systems are independent of each other if coordinate values in one cannot be converted or transformed into coordinate values in the other.

Note

As a departure to ISO 19111:2019, we allow to build a CompoundCRS from CRS objects, whereas ISO19111:2019 restricts the components to SingleCRS.

Public Functions

const std::vector<CRSNNPtr> &componentReferenceSystems()

Return the components of a CompoundCRS.

Returns:

the components.

std::list<std::pair<CompoundCRSNNPtr, int>> identify(const io::AuthorityFactoryPtr &authorityFactory) const

Identify the CRS with reference CRSs.

The candidate CRSs are looked in the database when authorityFactory is not null.

Note that the implementation uses a set of heuristics to have a good compromise of successful identifications over execution time. It might miss legitimate matches in some circumstances.

The method returns a list of matching reference CRS, and the percentage (0-100) of confidence in the match. The list is sorted by decreasing confidence.

100% means that the name of the reference entry perfectly matches the CRS name, and both are equivalent. In which case a single result is returned. 90% means that CRS are equivalent, but the names are not exactly the same. 70% means that CRS are equivalent (equivalent horizontal and vertical CRS), but the names are not equivalent. 25% means that the CRS are not equivalent, but there is some similarity in the names.

Parameters:

authorityFactory -- Authority factory (if null, will return an empty list)

Returns:

a list of matching reference CRS, and the percentage (0-100) of confidence in the match.

Public Static Functions

static CompoundCRSNNPtr create(const util::PropertyMap &properties, const std::vector<CRSNNPtr> &components)

Instantiate a CompoundCRS from a vector of CRS.

Parameters:
Throws:

InvalidCompoundCRSException --

Returns:

new CompoundCRS.

class BoundCRS : public osgeo::proj::crs::CRS, public osgeo::proj::io::IPROJStringExportable
#include <crs.hpp>

A coordinate reference system with an associated transformation to a target/hub CRS.

The definition of a CRS is not dependent upon any relationship to an independent CRS. However in an implementation that merges datasets referenced to differing CRSs, it is sometimes useful to associate the definition of the transformation that has been used with the CRS definition. This facilitates the interrelationship of CRS by concatenating transformations via a common or hub CRS. This is sometimes referred to as "early-binding". WKT2 standard permits the association of an abridged coordinate transformation description with a coordinate reference system description in a single text string. In a BoundCRS, the abridged coordinate transformation is applied to the source CRS with the target CRS being the common or hub system.

Coordinates referring to a BoundCRS are expressed into its source/base CRS.

This abstraction can for example model the concept of TOWGS84 datum shift present in WKT1 specification.

Remark

Implements BoundCRS from WKT2 standard

Note

Contrary to other CRS classes of this package, there is no ISO 19111:2019 modelling of a BoundCRS.

Public Functions

const CRSNNPtr &baseCRS()

Return the base CRS.

This is the CRS into which coordinates of the BoundCRS are expressed.

Returns:

the base CRS.

CRSNNPtr baseCRSWithCanonicalBoundCRS() const

Return a shallow clone of the base CRS that points to a shallow clone of this BoundCRS.

The base CRS is the CRS into which coordinates of the BoundCRS are expressed.

The returned CRS will actually be a shallow clone of the actual base CRS, with the extra property that CRS::canonicalBoundCRS() will point to a shallow clone of this BoundCRS. Use this only if you want to work with the base CRS object rather than the BoundCRS, but wanting to be able to retrieve the BoundCRS later.

Returns:

the base CRS.

const CRSNNPtr &hubCRS()

Return the target / hub CRS.

Returns:

the hub CRS.

const operation::TransformationNNPtr &transformation()

Return the transformation to the hub RS.

Returns:

transformation.

Public Static Functions

static BoundCRSNNPtr create(const util::PropertyMap &properties, const CRSNNPtr &baseCRSIn, const CRSNNPtr &hubCRSIn, const operation::TransformationNNPtr &transformationIn)

Instantiate a BoundCRS from a base CRS, a hub CRS and a transformation.

Since

PROJ 8.2

Parameters:
Returns:

new BoundCRS.

static BoundCRSNNPtr create(const CRSNNPtr &baseCRSIn, const CRSNNPtr &hubCRSIn, const operation::TransformationNNPtr &transformationIn)

Instantiate a BoundCRS from a base CRS, a hub CRS and a transformation.

Parameters:
  • baseCRSIn -- base CRS.

  • hubCRSIn -- hub CRS.

  • transformationIn -- transformation from base CRS to hub CRS.

Returns:

new BoundCRS.

static BoundCRSNNPtr createFromTOWGS84(const CRSNNPtr &baseCRSIn, const std::vector<double> &TOWGS84Parameters)

Instantiate a BoundCRS from a base CRS and TOWGS84 parameters.

Parameters:
  • baseCRSIn -- base CRS.

  • TOWGS84Parameters -- a vector of 3 or 7 double values representing WKT1 TOWGS84 parameter.

Returns:

new BoundCRS.

static BoundCRSNNPtr createFromNadgrids(const CRSNNPtr &baseCRSIn, const std::string &filename)

Instantiate a BoundCRS from a base CRS and nadgrids parameters.

Parameters:
  • baseCRSIn -- base CRS.

  • filename -- Horizontal grid filename

Returns:

new BoundCRS.

class DerivedGeodeticCRS : public osgeo::proj::crs::GeodeticCRS, public osgeo::proj::crs::DerivedCRS
#include <crs.hpp>

A derived coordinate reference system which has either a geodetic or a geographic coordinate reference system as its base CRS, thereby inheriting a geodetic reference frame, and associated with a 3D Cartesian or spherical coordinate system.

Remark

Implements DerivedGeodeticCRS from ISO 19111:2019

Public Functions

const GeodeticCRSNNPtr baseCRS() const

Return the base CRS (a GeodeticCRS) of a DerivedGeodeticCRS.

Returns:

the base CRS.

Public Static Functions

static DerivedGeodeticCRSNNPtr create(const util::PropertyMap &properties, const GeodeticCRSNNPtr &baseCRSIn, const operation::ConversionNNPtr &derivingConversionIn, const cs::CartesianCSNNPtr &csIn)

Instantiate a DerivedGeodeticCRS from a base CRS, a deriving conversion and a cs::CartesianCS.

Parameters:
  • properties -- See General properties. At minimum the name should be defined.

  • baseCRSIn -- base CRS.

  • derivingConversionIn -- the deriving conversion from the base CRS to this CRS.

  • csIn -- the coordinate system.

Returns:

new DerivedGeodeticCRS.

static DerivedGeodeticCRSNNPtr create(const util::PropertyMap &properties, const GeodeticCRSNNPtr &baseCRSIn, const operation::ConversionNNPtr &derivingConversionIn, const cs::SphericalCSNNPtr &csIn)

Instantiate a DerivedGeodeticCRS from a base CRS, a deriving conversion and a cs::SphericalCS.

Parameters:
  • properties -- See General properties. At minimum the name should be defined.

  • baseCRSIn -- base CRS.

  • derivingConversionIn -- the deriving conversion from the base CRS to this CRS.

  • csIn -- the coordinate system.

Returns:

new DerivedGeodeticCRS.

class DerivedGeographicCRS : public osgeo::proj::crs::GeographicCRS, public osgeo::proj::crs::DerivedCRS
#include <crs.hpp>

A derived coordinate reference system which has either a geodetic or a geographic coordinate reference system as its base CRS, thereby inheriting a geodetic reference frame, and an ellipsoidal coordinate system.

A derived geographic CRS can be based on a geodetic CRS only if that geodetic CRS definition includes an ellipsoid.

Remark

Implements DerivedGeographicCRS from ISO 19111:2019

Public Functions

const GeodeticCRSNNPtr baseCRS() const

Return the base CRS (a GeodeticCRS) of a DerivedGeographicCRS.

Returns:

the base CRS.

DerivedGeographicCRSNNPtr demoteTo2D(const std::string &newName, const io::DatabaseContextPtr &dbContext) const

Return a variant of this CRS "demoted" to a 2D one, if not already the case.

Since

8.1.1

Parameters:
  • newName -- Name of the new CRS. If empty, nameStr() will be used.

  • dbContext -- Database context to look for potentially already registered 2D CRS. May be nullptr.

Returns:

a new CRS demoted to 2D, or the current one if already 2D or not applicable.

Public Static Functions

static DerivedGeographicCRSNNPtr create(const util::PropertyMap &properties, const GeodeticCRSNNPtr &baseCRSIn, const operation::ConversionNNPtr &derivingConversionIn, const cs::EllipsoidalCSNNPtr &csIn)

Instantiate a DerivedGeographicCRS from a base CRS, a deriving conversion and a cs::EllipsoidalCS.

Parameters:
  • properties -- See General properties. At minimum the name should be defined.

  • baseCRSIn -- base CRS.

  • derivingConversionIn -- the deriving conversion from the base CRS to this CRS.

  • csIn -- the coordinate system.

Returns:

new DerivedGeographicCRS.

class DerivedProjectedCRS : public osgeo::proj::crs::DerivedCRS
#include <crs.hpp>

A derived coordinate reference system which has a projected coordinate reference system as its base CRS, thereby inheriting a geodetic reference frame, but also inheriting the distortion characteristics of the base projected CRS.

A DerivedProjectedCRS is not a ProjectedCRS.

Remark

Implements DerivedProjectedCRS from ISO 19111:2019

Public Functions

const ProjectedCRSNNPtr baseCRS() const

Return the base CRS (a ProjectedCRS) of a DerivedProjectedCRS.

Returns:

the base CRS.

DerivedProjectedCRSNNPtr demoteTo2D(const std::string &newName, const io::DatabaseContextPtr &dbContext) const

Return a variant of this CRS "demoted" to a 2D one, if not already the case.

Since

9.1.1

Parameters:
  • newName -- Name of the new CRS. If empty, nameStr() will be used.

  • dbContext -- Database context to look for potentially already registered 2D CRS. May be nullptr.

Returns:

a new CRS demoted to 2D, or the current one if already 2D or not applicable.

Public Static Functions

static DerivedProjectedCRSNNPtr create(const util::PropertyMap &properties, const ProjectedCRSNNPtr &baseCRSIn, const operation::ConversionNNPtr &derivingConversionIn, const cs::CoordinateSystemNNPtr &csIn)

Instantiate a DerivedProjectedCRS from a base CRS, a deriving conversion and a cs::CS.

Parameters:
  • properties -- See General properties. At minimum the name should be defined.

  • baseCRSIn -- base CRS.

  • derivingConversionIn -- the deriving conversion from the base CRS to this CRS.

  • csIn -- the coordinate system.

Returns:

new DerivedProjectedCRS.

class DerivedVerticalCRS : public osgeo::proj::crs::VerticalCRS, public osgeo::proj::crs::DerivedCRS
#include <crs.hpp>

A derived coordinate reference system which has a vertical coordinate reference system as its base CRS, thereby inheriting a vertical reference frame, and a vertical coordinate system.

Remark

Implements DerivedVerticalCRS from ISO 19111:2019

Public Functions

const VerticalCRSNNPtr baseCRS() const

Return the base CRS (a VerticalCRS) of a DerivedVerticalCRS.

Returns:

the base CRS.

Public Static Functions

static DerivedVerticalCRSNNPtr create(const util::PropertyMap &properties, const VerticalCRSNNPtr &baseCRSIn, const operation::ConversionNNPtr &derivingConversionIn, const cs::VerticalCSNNPtr &csIn)

Instantiate a DerivedVerticalCRS from a base CRS, a deriving conversion and a cs::VerticalCS.

Parameters:
  • properties -- See General properties. At minimum the name should be defined.

  • baseCRSIn -- base CRS.

  • derivingConversionIn -- the deriving conversion from the base CRS to this CRS.

  • csIn -- the coordinate system.

Returns:

new DerivedVerticalCRS.

template<class DerivedCRSTraits>
class DerivedCRSTemplate : public DerivedCRSTraits::BaseType, public osgeo::proj::crs::DerivedCRS
#include <crs.hpp>

Template representing a derived coordinate reference system.

Public Types

typedef util::nn<std::shared_ptr<DerivedCRSTemplate>> NNPtr

Non-null shared pointer of DerivedCRSTemplate

typedef util::nn<std::shared_ptr<BaseType>> BaseNNPtr

Non-null shared pointer of BaseType

typedef util::nn<std::shared_ptr<CSType>> CSNNPtr

Non-null shared pointer of CSType

Public Functions

const BaseNNPtr baseCRS() const

Return the base CRS of a DerivedCRSTemplate.

Returns:

the base CRS.

Public Static Functions

static NNPtr create(const util::PropertyMap &properties, const BaseNNPtr &baseCRSIn, const operation::ConversionNNPtr &derivingConversionIn, const CSNNPtr &csIn)

Instantiate a DerivedCRSTemplate from a base CRS, a deriving conversion and a cs::CoordinateSystem.

Parameters:
  • properties -- See General properties. At minimum the name should be defined.

  • baseCRSIn -- base CRS.

  • derivingConversionIn -- the deriving conversion from the base CRS to this CRS.

  • csIn -- the coordinate system.

Returns:

new DerivedCRSTemplate.

class DerivedEngineeringCRS : public osgeo::proj::crs::DerivedCRSTemplate<DerivedEngineeringCRSTraits>
#include <crs.hpp>

A derived coordinate reference system which has an engineering coordinate reference system as its base CRS, thereby inheriting an engineering datum, and is associated with one of the coordinate system types for an EngineeringCRS.

Remark

Implements DerivedEngineeringCRS from ISO 19111:2019

class DerivedParametricCRS : public osgeo::proj::crs::DerivedCRSTemplate<DerivedParametricCRSTraits>
#include <crs.hpp>

A derived coordinate reference system which has a parametric coordinate reference system as its base CRS, thereby inheriting a parametric datum, and a parametric coordinate system.

Remark

Implements DerivedParametricCRS from ISO 19111:2019

class DerivedTemporalCRS : public osgeo::proj::crs::DerivedCRSTemplate<DerivedTemporalCRSTraits>
#include <crs.hpp>

A derived coordinate reference system which has a temporal coordinate reference system as its base CRS, thereby inheriting a temporal datum, and a temporal coordinate system.

Remark

Implements DerivedTemporalCRS from ISO 19111:2019