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 Angle : public osgeo::proj::common::Measure
#include <common.hpp>

Numeric value, with a angular unit of measure.

Public Functions

Angle(double valueIn = 0.0)

Instantiate a Angle.

Parameters
  • valueIn: value

Angle(double valueIn, const UnitOfMeasure &unitIn)

Instantiate a Angle.

Parameters

class DataEpoch
#include <common.hpp>

Data epoch.

Public Functions

const Measure &coordinateEpoch() const

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

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

DateTime create(const std::string &str)

Instantiate a DateTime.

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

Abstract class representating 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::DatumEnsemble, osgeo::proj::datum::Ellipsoid, osgeo::proj::datum::PrimeMeridian, osgeo::proj::operation::GeneralOperationParameter, osgeo::proj::operation::OperationMethod

Public Functions

const 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<IdentifierNNPtr> &identifiers()

Return the identifier(s) of the object.

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

const std::vector<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.

Return

code, or 0 if not found

Public Static Attributes

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.

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.

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.

const std::string REMARKS_KEY

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

The value is to be provided as a string.

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 Length : public osgeo::proj::common::Measure
#include <common.hpp>

Numeric value, with a linear unit of measure.

Public Functions

Length(double valueIn = 0.0)

Instantiate a Length.

Parameters
  • valueIn: value

Length(double valueIn, const UnitOfMeasure &unitIn)

Instantiate a Length.

Parameters

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.

Return

true if objects are equivalent.

Parameters
  • other: other object to compare to

  • criterion: comparaison criterion.

  • maxRelativeError: Maximum relative error allowed.

Public Static Attributes

constexpr double DEFAULT_MAX_REL_ERROR = 1e-10

Default maximum resulative error.

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 optional<std::string> &scope()

Return the scope.

Return

the scope, or empty.

const ExtentPtr &domainOfValidity()

Return the domain of validity.

Return

the domain of validity, or nullptr.

Public Static Functions

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::operation::CoordinateOperation

Public Functions

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

Return the domains of the object.

Public Static Attributes

const std::string SCOPE_KEY

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

The value is to be provided as a string.

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.

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.

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

Numeric value, without a physical unit of measure.

Public Functions

Scale(double valueIn = 0.0)

Instantiate a Scale.

Parameters
  • valueIn: value

Scale(double valueIn, const UnitOfMeasure &unitIn)

Instantiate a Scale.

Parameters

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

Unit of measure.

This is a mutable object.

Public Types

enum Type

Type of unit of measure.

Values:

UNKNOWN

Unknown unit of measure

NONE

No unit of measure

ANGULAR

Angular unit of measure

LINEAR

Linear unit of measure

SCALE

Scale unit of measure

TIME

Time unit of measure

PARAMETRIC

Parametric unit of measure

Public Functions

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)

Return

the conversion factor, or 0 if no conversion exists.

UnitOfMeasure::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”

Return

the code space, or empty string.

const std::string &code()

Return the code of the unit of measure.

Return

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

const UnitOfMeasure NONE

“Empty”/”None”, unit of measure of type NONE.

const UnitOfMeasure SCALE_UNITY

Scale unity, unit of measure of type SCALE.

const UnitOfMeasure PARTS_PER_MILLION

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

const UnitOfMeasure PPM_PER_YEAR

Part-sper-million per year, unit of measure of type SCALE.

const UnitOfMeasure METRE

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

const UnitOfMeasure METRE_PER_YEAR

Metre per year, unit of measure of type LINEAR.

const UnitOfMeasure RADIAN

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

const UnitOfMeasure MICRORADIAN

Microradian, unit of measure of type ANGULAR.

const UnitOfMeasure DEGREE

Degree, unit of measure of type ANGULAR.

const UnitOfMeasure ARC_SECOND

Arc-second, unit of measure of type ANGULAR.

const UnitOfMeasure GRAD

Grad, unit of measure of type ANGULAR.

const UnitOfMeasure ARC_SECOND_PER_YEAR

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

const UnitOfMeasure SECOND

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

const UnitOfMeasure YEAR

Year, unit of measure of type TIME.