common namespace

namespace common

Common classes.

osgeo.proj.common namespace

Typedefs

typedef std::shared_ptr<UnitOfMeasure> UnitOfMeasurePtr

Shared pointer of UnitOfMeasure.

typedef util::nn<UnitOfMeasurePtr> UnitOfMeasureNNPtr

Non-null shared pointer of UnitOfMeasure.

typedef std::shared_ptr<IdentifiedObject> IdentifiedObjectPtr

Shared pointer of IdentifiedObject.

typedef util::nn<IdentifiedObjectPtr> IdentifiedObjectNNPtr

Non-null shared pointer of IdentifiedObject.

using ObjectDomainPtr = std::shared_ptr<ObjectDomain>

Shared pointer of ObjectDomain.

using ObjectDomainNNPtr = util::nn<ObjectDomainPtr>

Non-null shared pointer of ObjectDomain.

using ObjectUsagePtr = std::shared_ptr<ObjectUsage>

Shared pointer of ObjectUsage.

using ObjectUsageNNPtr = util::nn<ObjectUsagePtr>

Non-null shared pointer of ObjectUsage.

class UnitOfMeasure : public osgeo::proj::util::BaseObject
#include <common.hpp>

Unit of measure.

This is a mutable object.

Public Types

enum class Type

Type of unit of measure.

Values:

enumerator UNKNOWN

Unknown unit of measure

enumerator NONE

No unit of measure

enumerator ANGULAR

Angular unit of measure

enumerator LINEAR

Linear unit of measure

enumerator SCALE

Scale unit of measure

enumerator TIME

Time unit of measure

enumerator PARAMETRIC

Parametric unit of measure

Public Functions

explicit UnitOfMeasure(const std::string &nameIn = std::string(), double toSIIn = 1.0, Type typeIn = Type::UNKNOWN, const std::string &codeSpaceIn = std::string(), const std::string &codeIn = std::string())

Creates a UnitOfMeasure.

const std::string &name()

Return the name of the unit of measure.

double conversionToSI()

Return the conversion factor to the unit of the International System of Units of the same Type.

For example, for foot, this would be 0.3048 (metre)

Returns:

the conversion factor, or 0 if no conversion exists.

Type type()

Return the type of the unit of measure.

const std::string &codeSpace()

Return the code space of the unit of measure.

For example "EPSG"

Returns:

the code space, or empty string.

const std::string &code()

Return the code of the unit of measure.

Returns:

the code, or empty string.

bool operator==(const UnitOfMeasure &other)

Returns whether two units of measures are equal.

The comparison is based on the name.

bool operator!=(const UnitOfMeasure &other)

Returns whether two units of measures are different.

The comparison is based on the name.

Public Static Attributes

static const UnitOfMeasure NONE

"Empty"/"None", unit of measure of type NONE.

static const UnitOfMeasure SCALE_UNITY

Scale unity, unit of measure of type SCALE.

static const UnitOfMeasure PARTS_PER_MILLION

Parts-per-million, unit of measure of type SCALE.

static const UnitOfMeasure PPM_PER_YEAR

Parts-per-million per year, unit of measure of type SCALE.

static const UnitOfMeasure METRE

Metre, unit of measure of type LINEAR (SI unit).

static const UnitOfMeasure METRE_PER_YEAR

Metre per year, unit of measure of type LINEAR.

static const UnitOfMeasure FOOT

Foot, unit of measure of type LINEAR.

static const UnitOfMeasure US_FOOT

US survey foot, unit of measure of type LINEAR.

static const UnitOfMeasure RADIAN

Radian, unit of measure of type ANGULAR (SI unit).

static const UnitOfMeasure MICRORADIAN

Microradian, unit of measure of type ANGULAR.

static const UnitOfMeasure DEGREE

Degree, unit of measure of type ANGULAR.

static const UnitOfMeasure ARC_SECOND

Arc-second, unit of measure of type ANGULAR.

static const UnitOfMeasure GRAD

Grad, unit of measure of type ANGULAR.

static const UnitOfMeasure ARC_SECOND_PER_YEAR

Arc-second per year, unit of measure of type ANGULAR.

static const UnitOfMeasure SECOND

Second, unit of measure of type TIME (SI unit).

static const UnitOfMeasure YEAR

Year, unit of measure of type TIME.

class Measure : public osgeo::proj::util::BaseObject
#include <common.hpp>

Numeric value associated with a UnitOfMeasure.

Subclassed by osgeo::proj::common::Angle, osgeo::proj::common::Length, osgeo::proj::common::Scale

Public Functions

Measure(double valueIn = 0.0, const UnitOfMeasure &unitIn = UnitOfMeasure())

Instantiate a Measure.

const UnitOfMeasure &unit()

Return the unit of the Measure.

double getSIValue()

Return the value of the Measure, after conversion to the corresponding unit of the International System.

double value()

Return the value of the measure, expressed in the unit()

double convertToUnit(const UnitOfMeasure &otherUnit)

Return the value of this measure expressed into the provided unit.

bool operator==(const Measure &other)

Return whether two measures are equal.

The comparison is done both on the value and the unit.

bool _isEquivalentTo(const Measure &other, util::IComparable::Criterion criterion = util::IComparable::Criterion::STRICT, double maxRelativeError = DEFAULT_MAX_REL_ERROR) const

Returns whether an object is equivalent to another one.

Parameters:
  • other -- other object to compare to

  • criterion -- comparison criterion.

  • maxRelativeError -- Maximum relative error allowed.

Returns:

true if objects are equivalent.

Public Static Attributes

static constexpr double DEFAULT_MAX_REL_ERROR = 1e-10

Default maximum resulative error.

class Scale : public osgeo::proj::common::Measure
#include <common.hpp>

Numeric value, without a physical unit of measure.

Public Functions

explicit Scale(double valueIn = 0.0)

Instantiate a Scale.

Parameters:

valueIn -- value

explicit Scale(double valueIn, const UnitOfMeasure &unitIn)

Instantiate a Scale.

Parameters:
class Angle : public osgeo::proj::common::Measure
#include <common.hpp>

Numeric value, with a angular unit of measure.

Public Functions

explicit Angle(double valueIn = 0.0)

Instantiate a Angle.

Parameters:

valueIn -- value

Angle(double valueIn, const UnitOfMeasure &unitIn)

Instantiate a Angle.

Parameters:
class Length : public osgeo::proj::common::Measure
#include <common.hpp>

Numeric value, with a linear unit of measure.

Public Functions

explicit Length(double valueIn = 0.0)

Instantiate a Length.

Parameters:

valueIn -- value

Length(double valueIn, const UnitOfMeasure &unitIn)

Instantiate a Length.

Parameters:
class DateTime
#include <common.hpp>

Date-time value, as a ISO:8601 encoded string, or other string encoding.

Public Functions

bool isISO_8601() const

Return whether the DateTime is ISO:8601 compliant.

Remark

The current implementation is really simplistic, and aimed at detecting date-times that are not ISO:8601 compliant.

std::string toString() const

Return the DateTime as a string.

Public Static Functions

static DateTime create(const std::string &str)

Instantiate a DateTime.

class DataEpoch
#include <common.hpp>

Data epoch.

Public Functions

const Measure &coordinateEpoch() const

Return the coordinate epoch, as a measure in decimal year.

class IdentifiedObject : public osgeo::proj::util::BaseObject, public osgeo::proj::util::IComparable, public osgeo::proj::io::IWKTExportable
#include <common.hpp>

Abstract class representing a CRS-related object that has an identification.

Remark

Implements IdentifiedObject from ISO 19111:2019

Subclassed by osgeo::proj::common::ObjectUsage, osgeo::proj::cs::CoordinateSystem, osgeo::proj::cs::CoordinateSystemAxis, osgeo::proj::cs::Meridian, osgeo::proj::datum::Ellipsoid, osgeo::proj::datum::PrimeMeridian, osgeo::proj::operation::GeneralOperationParameter, osgeo::proj::operation::OperationMethod

Public Functions

const metadata::IdentifierNNPtr &name()

Return the name of the object.

Generally, the only interesting field of the name will be name()->description().

const std::string &nameStr()

Return the name of the object.

Return *(name()->description())

const std::vector<metadata::IdentifierNNPtr> &identifiers()

Return the identifier(s) of the object.

Generally, those will have Identifier::code() and Identifier::codeSpace() filled.

const std::vector<util::GenericNameNNPtr> &aliases()

Return the alias(es) of the object.

const std::string &remarks()

Return the remarks.

bool isDeprecated()

Return whether the object is deprecated.

Remark

Extension of ISO 19111:2019

std::string alias()

Return the (first) alias of the object as a string.

Shortcut for aliases()[0]->toFullyQualifiedName()->toString()

int getEPSGCode()

Return the EPSG code.

Returns:

code, or 0 if not found

Public Static Attributes

static const std::string NAME_KEY

Key to set the name of a common::IdentifiedObject.

The value is to be provided as a string or metadata::IdentifierNNPtr.

static const std::string IDENTIFIERS_KEY

Key to set the identifier(s) of a common::IdentifiedObject.

The value is to be provided as a common::IdentifierNNPtr or a util::ArrayOfBaseObjectNNPtr of common::IdentifierNNPtr.

static const std::string ALIAS_KEY

Key to set the alias(es) of a common::IdentifiedObject.

The value is to be provided as string, a util::GenericNameNNPtr or a util::ArrayOfBaseObjectNNPtr of util::GenericNameNNPtr.

static const std::string REMARKS_KEY

Key to set the remarks of a common::IdentifiedObject.

The value is to be provided as a string.

static const std::string DEPRECATED_KEY

Key to set the deprecation flag of a common::IdentifiedObject.

The value is to be provided as a boolean.

class ObjectDomain : public osgeo::proj::util::BaseObject, public osgeo::proj::util::IComparable
#include <common.hpp>

The scope and validity of a CRS-related object.

Remark

Implements ObjectDomain from ISO 19111:2019

Public Functions

const util::optional<std::string> &scope()

Return the scope.

Returns:

the scope, or empty.

const metadata::ExtentPtr &domainOfValidity()

Return the domain of validity.

Returns:

the domain of validity, or nullptr.

Public Static Functions

static ObjectDomainNNPtr create(const util::optional<std::string> &scopeIn, const metadata::ExtentPtr &extent)

Instantiate a ObjectDomain.

class ObjectUsage : public osgeo::proj::common::IdentifiedObject
#include <common.hpp>

Abstract class of a CRS-related object that has usages.

Remark

Implements ObjectUsage from ISO 19111:2019

Subclassed by osgeo::proj::crs::CRS, osgeo::proj::datum::Datum, osgeo::proj::datum::DatumEnsemble, osgeo::proj::operation::CoordinateOperation

Public Functions

const std::vector<ObjectDomainNNPtr> &domains()

Return the domains of the object.

Public Static Attributes

static const std::string SCOPE_KEY

Key to set the scope of a common::ObjectUsage.

The value is to be provided as a string.

static const std::string DOMAIN_OF_VALIDITY_KEY

Key to set the domain of validity of a common::ObjectUsage.

The value is to be provided as a common::ExtentNNPtr.

static const std::string OBJECT_DOMAIN_KEY

Key to set the object domain(s) of a common::ObjectUsage.

The value is to be provided as a common::ObjectDomainNNPtr or a util::ArrayOfBaseObjectNNPtr of common::ObjectDomainNNPtr.