util namespace

namespace util

A set of base types from ISO 19103, GeoAPI and other PROJ specific classes.

osgeo.proj.util namespace.


using BaseObjectPtr = std::shared_ptr<BaseObject>

Shared pointer of BaseObject.

using BoxedValuePtr = std::shared_ptr<BoxedValue>

Shared pointer of BoxedValue.

using BoxedValueNNPtr = util::nn<BoxedValuePtr>

Non-null shared pointer of BoxedValue.

using ArrayOfBaseObjectPtr = std::shared_ptr<ArrayOfBaseObject>

Shared pointer of ArrayOfBaseObject.

using ArrayOfBaseObjectNNPtr = util::nn<ArrayOfBaseObjectPtr>

Non-null shared pointer of ArrayOfBaseObject.

using LocalNamePtr = std::shared_ptr<LocalName>

Shared pointer of LocalName.

using LocalNameNNPtr = util::nn<LocalNamePtr>

Non-null shared pointer of LocalName.

using NameSpacePtr = std::shared_ptr<NameSpace>

Shared pointer of NameSpace.

using NameSpaceNNPtr = util::nn<NameSpacePtr>

Non-null shared pointer of NameSpace.

using GenericNamePtr = std::shared_ptr<GenericName>

Shared pointer of GenericName.

using GenericNameNNPtr = util::nn<GenericNamePtr>

Non-null shared pointer of GenericName.

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

Array of BaseObject.

Public Functions

void add(const BaseObjectNNPtr &obj)

Adds an object to the array.

  • obj: the object to add.

Public Static Functions

ArrayOfBaseObjectNNPtr create()

Instantiate a ArrayOfBaseObject.


a new ArrayOfBaseObject.

class BaseObject
#include <util.hpp>

Class that can be derived from, to emulate Java’s Object behaviour.

Subclassed by osgeo::proj::common::IdentifiedObject, osgeo::proj::common::Measure, osgeo::proj::common::ObjectDomain, osgeo::proj::common::UnitOfMeasure, osgeo::proj::metadata::Citation, osgeo::proj::metadata::Extent, osgeo::proj::metadata::GeographicExtent, osgeo::proj::metadata::Identifier, osgeo::proj::metadata::PositionalAccuracy, osgeo::proj::metadata::TemporalExtent, osgeo::proj::metadata::VerticalExtent, osgeo::proj::operation::GeneralParameterValue, osgeo::proj::operation::ParameterValue, osgeo::proj::util::ArrayOfBaseObject, osgeo::proj::util::BoxedValue, osgeo::proj::util::GenericName

struct BaseObjectNNPtr : public util::nn<BaseObjectPtr>
#include <util.hpp>

Non-null shared pointer of BaseObject.

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

Encapsulate standard datatypes in an object.

Public Functions

BoxedValue(const char *stringValueIn)

Constructs a BoxedValue from a string.

BoxedValue(const std::string &stringValueIn)

Constructs a BoxedValue from a string.

BoxedValue(int integerValueIn)

Constructs a BoxedValue from an integer.

BoxedValue(bool booleanValueIn)

Constructs a BoxedValue from a boolean.

class CodeList
#include <util.hpp>

Abstract class to define an enumeration of values.

Subclassed by osgeo::proj::cs::AxisDirection, osgeo::proj::datum::RealizationMethod

Public Functions

const std::string &toString()

Return the CodeList item as a string.

operator std::string()

Return the CodeList item as a string.

class Exception : public exception
#include <util.hpp>

Root exception class.

Subclassed by osgeo::proj::io::FactoryException, osgeo::proj::io::FormattingException, osgeo::proj::io::ParsingException, osgeo::proj::operation::InvalidOperation, osgeo::proj::util::InvalidValueTypeException, osgeo::proj::util::UnsupportedOperationException

Public Functions

const char *what() const

Return the exception text.

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

A sequence of identifiers rooted within the context of a namespace.


Simplified version of GenericName from GeoAPI

Subclassed by osgeo::proj::util::LocalName

Public Functions

virtual const NameSpacePtr scope() const = 0

Return the scope of the object, possibly a global one.

virtual std::string toString() const = 0

Return the LocalName as a string.

virtual GenericNameNNPtr toFullyQualifiedName() const = 0

Return a fully qualified name corresponding to the local name.

The namespace of the resulting name is a global one.

class IComparable
#include <util.hpp>

Interface for an object that can be compared to another.

Subclassed by osgeo::proj::common::IdentifiedObject, osgeo::proj::common::ObjectDomain, osgeo::proj::metadata::Extent, osgeo::proj::metadata::GeographicExtent, osgeo::proj::metadata::TemporalExtent, osgeo::proj::metadata::VerticalExtent, osgeo::proj::operation::GeneralParameterValue, osgeo::proj::operation::ParameterValue

Public Types

enum Criterion

Comparison criterion.



All properties are identical.


The objects are equivalent for the purpose of coordinate operations. They can differ by the name of their objects, identifiers, other metadata. Parameters may be expressed in different units, provided that the value is (with some tolerance) the same once expressed in a common unit.


Same as EQUIVALENT, relaxed with an exception that the axis order of the base CRS of a DerivedCRS/ProjectedCRS or the axis order of a GeographicCRS is ignored. Only to be used with DerivedCRS/ProjectedCRS/GeographicCRS

Public Functions

bool isEquivalentTo(const IComparable *other, Criterion criterion = Criterion::STRICT) const

Returns whether an object is equivalent to another one.


true if objects are equivalent.

  • other: other object to compare to

  • criterion: comparaison criterion.

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

Exception thrown when an invalid value type is set as the value of a key of a PropertyMap.

class LocalName : public osgeo::proj::util::GenericName
#include <util.hpp>

Identifier within a NameSpace for a local object.

Local names are names which are directly accessible to and maintained by a NameSpace within which they are local, indicated by the scope.


Simplified version of LocalName from GeoAPI

Public Functions

const NameSpacePtr scope() const

Return the scope of the object, possibly a global one.

std::string toString() const

Return the LocalName as a string.

GenericNameNNPtr toFullyQualifiedName() const

Return a fully qualified name corresponding to the local name.

The namespace of the resulting name is a global one.

class NameFactory
#include <util.hpp>

Factory for generic names.


Simplified version of NameFactory from GeoAPI

Public Static Functions

NameSpaceNNPtr createNameSpace(const GenericNameNNPtr &name, const PropertyMap &properties)

Instantiate a NameSpace.


a new NameFactory.

  • name: name of the namespace.

  • properties: Properties. Allowed keys are “separator” and “separator.head”.

LocalNameNNPtr createLocalName(const NameSpacePtr &scope, const std::string &name)

Instantiate a LocalName.


a new LocalName.

  • scope: scope.

  • name: string of the local name.

GenericNameNNPtr createGenericName(const NameSpacePtr &scope, const std::vector<std::string> &parsedNames)

Instantiate a GenericName.


a new GenericName.

  • scope: scope.

  • parsedNames: the components of the name.

class NameSpace
#include <util.hpp>

A domain in which names given by strings are defined.


Simplified version of NameSpace from GeoAPI

Public Functions

bool isGlobal() const

Returns whether this is a global namespace.

const GenericNamePtr &name() const

Returns the name of this namespace.

template<class T>
class optional
#include <util.hpp>

Loose transposition of std::optional available from C++17.

Public Functions

const T *operator->() const

Returns a pointer to the contained value.

const T &operator*() const

Returns a reference to the contained value.

operator bool() const

Return whether the optional has a value

bool has_value() const

Return whether the optional has a value

class PropertyMap
#include <util.hpp>

Wrapper of a std::map<std::string, BaseObjectNNPtr>

Public Functions

PropertyMap &set(const std::string &key, const BaseObjectNNPtr &val)

Set a BaseObjectNNPtr as the value of a key.

PropertyMap &set(const std::string &key, const char *val)

Set a string as the value of a key.

PropertyMap &set(const std::string &key, const std::string &val)

Set a string as the value of a key.

PropertyMap &set(const std::string &key, int val)

Set a integer as the value of a key.

PropertyMap &set(const std::string &key, bool val)

Set a boolean as the value of a key.

PropertyMap &set(const std::string &key, const std::vector<std::string> &array)

Set a vector of strings as the value of a key.

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

Exception Thrown to indicate that the requested operation is not supported.