PROJ C++ API
Public Types | Public Member Functions | Static Public Member Functions | List of all members
osgeo::proj::io::AuthorityFactory Class Reference

Builds object from an authority database. More...

#include <io.hpp>

Public Types

enum  ObjectType {
  ObjectType::PRIME_MERIDIAN, ObjectType::ELLIPSOID, ObjectType::DATUM, ObjectType::GEODETIC_REFERENCE_FRAME,
  ObjectType::VERTICAL_REFERENCE_FRAME, ObjectType::CRS, ObjectType::GEODETIC_CRS, ObjectType::GEOGRAPHIC_CRS,
  ObjectType::PROJECTED_CRS, ObjectType::VERTICAL_CRS, ObjectType::COMPOUND_CRS, ObjectType::COORDINATE_OPERATION,
  ObjectType::CONVERSION, ObjectType::TRANSFORMATION, ObjectType::CONCATENATED_OPERATION
}
 

Public Member Functions

util::BaseObjectNNPtr createObject (const std::string &code) const
 Returns an arbitrary object from a code. More...
 
common::UnitOfMeasureNNPtr createUnitOfMeasure (const std::string &code) const
 Returns a common::UnitOfMeasure from the specified code. More...
 
metadata::ExtentNNPtr createExtent (const std::string &code) const
 Returns a metadata::Extent from the specified code. More...
 
datum::PrimeMeridianNNPtr createPrimeMeridian (const std::string &code) const
 Returns a datum::PrimeMeridian from the specified code. More...
 
std::string identifyBodyFromSemiMajorAxis (double a, double tolerance) const
 Identify a celestial body from an approximate radius. More...
 
datum::EllipsoidNNPtr createEllipsoid (const std::string &code) const
 Returns a datum::Ellipsoid from the specified code. More...
 
datum::DatumNNPtr createDatum (const std::string &code) const
 Returns a datum::Datum from the specified code. More...
 
datum::GeodeticReferenceFrameNNPtr createGeodeticDatum (const std::string &code) const
 Returns a datum::GeodeticReferenceFrame from the specified code. More...
 
datum::VerticalReferenceFrameNNPtr createVerticalDatum (const std::string &code) const
 Returns a datum::VerticalReferenceFrame from the specified code. More...
 
cs::CoordinateSystemNNPtr createCoordinateSystem (const std::string &code) const
 Returns a cs::CoordinateSystem from the specified code. More...
 
crs::GeodeticCRSNNPtr createGeodeticCRS (const std::string &code) const
 Returns a crs::GeodeticCRS from the specified code. More...
 
crs::GeographicCRSNNPtr createGeographicCRS (const std::string &code) const
 Returns a crs::GeographicCRS from the specified code. More...
 
crs::VerticalCRSNNPtr createVerticalCRS (const std::string &code) const
 Returns a crs::VerticalCRS from the specified code. More...
 
operation::ConversionNNPtr createConversion (const std::string &code) const
 Returns a operation::Conversion from the specified code. More...
 
crs::ProjectedCRSNNPtr createProjectedCRS (const std::string &code) const
 Returns a crs::ProjectedCRS from the specified code. More...
 
crs::CompoundCRSNNPtr createCompoundCRS (const std::string &code) const
 Returns a crs::CompoundCRS from the specified code. More...
 
crs::CRSNNPtr createCoordinateReferenceSystem (const std::string &code) const
 Returns a crs::CRS from the specified code. More...
 
operation::CoordinateOperationNNPtr createCoordinateOperation (const std::string &code, bool usePROJAlternativeGridNames) const
 Returns a operation::CoordinateOperation from the specified code. More...
 
std::vector< operation::CoordinateOperationNNPtrcreateFromCoordinateReferenceSystemCodes (const std::string &sourceCRSCode, const std::string &targetCRSCode) const
 Returns a list operation::CoordinateOperation between two CRS. More...
 
const std::string & getAuthority () PROJ_CONST_DECL
 Returns the authority name associated to this factory. More...
 
std::set< std::string > getAuthorityCodes (const ObjectType &type, bool allowDeprecated=true) const
 Returns the set of authority codes of the given object type. More...
 
std::string getDescriptionText (const std::string &code) const
 Gets a description of the object corresponding to a code. More...
 
DatabaseContextNNPtr databaseContext () const
 Returns the database context.
 
std::vector< operation::CoordinateOperationNNPtrcreateFromCoordinateReferenceSystemCodes (const std::string &sourceCRSAuthName, const std::string &sourceCRSCode, const std::string &targetCRSAuthName, const std::string &targetCRSCode, bool usePROJAlternativeGridNames, bool discardIfMissingGrid) const
 Returns a list operation::CoordinateOperation between two CRS. More...
 
std::vector< operation::CoordinateOperationNNPtrcreateFromCRSCodesWithIntermediates (const std::string &sourceCRSAuthName, const std::string &sourceCRSCode, const std::string &targetCRSAuthName, const std::string &targetCRSCode, bool usePROJAlternativeGridNames, bool discardIfMissingGrid, const std::vector< std::pair< std::string, std::string >> &intermediateCRSAuthCodes) const
 Returns a list operation::CoordinateOperation between two CRS, using intermediate codes. More...
 

Static Public Member Functions

static AuthorityFactoryNNPtr create (DatabaseContextNNPtr context, const std::string &authorityName)
 Instanciate a AuthorityFactory. More...
 

Detailed Description

Builds object from an authority database.

A AuthorityFactory should be used only by one thread at a time.

Remarks
Implements AuthorityFactory from GeoAPI

Member Enumeration Documentation

Object type.

Enumerator
PRIME_MERIDIAN 

Object of type datum::PrimeMeridian

ELLIPSOID 

Object of type datum::Ellipsoid

DATUM 

Object of type datum::Datum (and derived classes)

GEODETIC_REFERENCE_FRAME 

Object of type datum::GeodeticReferenceFrame (and derived classes)

VERTICAL_REFERENCE_FRAME 

Object of type datum::VerticalReferenceFrame (and derived classes)

CRS 

Object of type crs::CRS (and derived classes)

GEODETIC_CRS 

Object of type crs::GeodeticCRS (and derived classes)

GEOGRAPHIC_CRS 

Object of type crs::GeographicCRS (and derived classes)

PROJECTED_CRS 

Object of type crs::ProjectedCRS (and derived classes)

VERTICAL_CRS 

Object of type crs::VerticalCRS (and derived classes)

COMPOUND_CRS 

Object of type crs::CompoundCRS (and derived classes)

COORDINATE_OPERATION 

Object of type operation::CoordinateOperation (and derived classes)

CONVERSION 

Object of type operation::Conversion (and derived classes)

TRANSFORMATION 

Object of type operation::Transformation (and derived classes)

CONCATENATED_OPERATION 

Object of type operation::ConcatenatedOperation (and derived classes)

Member Function Documentation

AuthorityFactoryNNPtr osgeo::proj::io::AuthorityFactory::create ( DatabaseContextNNPtr  context,
const std::string &  authorityName 
)
static

Instanciate a AuthorityFactory.

The authority name might be set to the empty string in the particular case where createFromCoordinateReferenceSystemCodes(const std::string&,const std::string&,const std::string&,const std::string&) const is called.

Parameters
contextContexte.
authorityNameAuthority name.
Returns
new AuthorityFactory.
crs::CompoundCRSNNPtr osgeo::proj::io::AuthorityFactory::createCompoundCRS ( const std::string &  code) const

Returns a crs::CompoundCRS from the specified code.

Parameters
codeObject code allocated by authority.
Returns
object.
Exceptions
NoSuchAuthorityCodeException
FactoryException
operation::ConversionNNPtr osgeo::proj::io::AuthorityFactory::createConversion ( const std::string &  code) const

Returns a operation::Conversion from the specified code.

Parameters
codeObject code allocated by authority.
Returns
object.
Exceptions
NoSuchAuthorityCodeException
FactoryException
operation::CoordinateOperationNNPtr osgeo::proj::io::AuthorityFactory::createCoordinateOperation ( const std::string &  code,
bool  usePROJAlternativeGridNames 
) const

Returns a operation::CoordinateOperation from the specified code.

Parameters
codeObject code allocated by authority.
usePROJAlternativeGridNamesWhether PROJ alternative grid names should be substituted to the official grid names.
Returns
object.
Exceptions
NoSuchAuthorityCodeException
FactoryException
crs::CRSNNPtr osgeo::proj::io::AuthorityFactory::createCoordinateReferenceSystem ( const std::string &  code) const

Returns a crs::CRS from the specified code.

Parameters
codeObject code allocated by authority.
Returns
object.
Exceptions
NoSuchAuthorityCodeException
FactoryException
cs::CoordinateSystemNNPtr osgeo::proj::io::AuthorityFactory::createCoordinateSystem ( const std::string &  code) const

Returns a cs::CoordinateSystem from the specified code.

Parameters
codeObject code allocated by authority.
Returns
object.
Exceptions
NoSuchAuthorityCodeException
FactoryException
datum::DatumNNPtr osgeo::proj::io::AuthorityFactory::createDatum ( const std::string &  code) const

Returns a datum::Datum from the specified code.

Parameters
codeObject code allocated by authority.
Returns
object.
Exceptions
NoSuchAuthorityCodeException
FactoryException
datum::EllipsoidNNPtr osgeo::proj::io::AuthorityFactory::createEllipsoid ( const std::string &  code) const

Returns a datum::Ellipsoid from the specified code.

Parameters
codeObject code allocated by authority.
Returns
object.
Exceptions
NoSuchAuthorityCodeException
FactoryException
metadata::ExtentNNPtr osgeo::proj::io::AuthorityFactory::createExtent ( const std::string &  code) const

Returns a metadata::Extent from the specified code.

Parameters
codeObject code allocated by authority.
Returns
object.
Exceptions
NoSuchAuthorityCodeException
FactoryException
std::vector< operation::CoordinateOperationNNPtr > osgeo::proj::io::AuthorityFactory::createFromCoordinateReferenceSystemCodes ( const std::string &  sourceCRSCode,
const std::string &  targetCRSCode 
) const

Returns a list operation::CoordinateOperation between two CRS.

The list is ordered with preferred operations first. No attempt is made at infering operations that are not explicitly in the database.

Deprecated operations are rejected.

Parameters
sourceCRSCodeSource CRS code allocated by authority.
targetCRSCodeSource CRS code allocated by authority.
Returns
list of coordinate operations
Exceptions
NoSuchAuthorityCodeException
FactoryException
std::vector< operation::CoordinateOperationNNPtr > osgeo::proj::io::AuthorityFactory::createFromCoordinateReferenceSystemCodes ( const std::string &  sourceCRSAuthName,
const std::string &  sourceCRSCode,
const std::string &  targetCRSAuthName,
const std::string &  targetCRSCode,
bool  usePROJAlternativeGridNames,
bool  discardIfMissingGrid 
) const

Returns a list operation::CoordinateOperation between two CRS.

The list is ordered with preferred operations first. No attempt is made at infering operations that are not explicitly in the database (see createFromCRSCodesWithIntermediates() for that), and only source -> target operations are searched (ie if target -> source is present, you need to call this method with the arguments reversed, and apply the reverse transformations).

Deprecated operations are rejected.

If getAuthority() returns empty, then coordinate operations from all authorities are considered.

Parameters
sourceCRSAuthNameAuthority name of sourceCRSCode
sourceCRSCodeSource CRS code allocated by authority sourceCRSAuthName.
targetCRSAuthNameAuthority name of targetCRSCode
targetCRSCodeSource CRS code allocated by authority targetCRSAuthName.
usePROJAlternativeGridNamesWhether PROJ alternative grid names should be substituted to the official grid names.
discardIfMissingGridWhether coordinate operations that reference missing grids should be removed from the result set.
Returns
list of coordinate operations
Exceptions
NoSuchAuthorityCodeException
FactoryException
std::vector< operation::CoordinateOperationNNPtr > osgeo::proj::io::AuthorityFactory::createFromCRSCodesWithIntermediates ( const std::string &  sourceCRSAuthName,
const std::string &  sourceCRSCode,
const std::string &  targetCRSAuthName,
const std::string &  targetCRSCode,
bool  usePROJAlternativeGridNames,
bool  discardIfMissingGrid,
const std::vector< std::pair< std::string, std::string >> &  intermediateCRSAuthCodes 
) const

Returns a list operation::CoordinateOperation between two CRS, using intermediate codes.

The list is ordered with preferred operations first.

Deprecated operations are rejected.

The method will take care of considering all potential combinations (ie contrary to createFromCoordinateReferenceSystemCodes(), you do not need to call it with sourceCRS and targetCRS switched)

If getAuthority() returns empty, then coordinate operations from all authorities are considered.

Parameters
sourceCRSAuthNameAuthority name of sourceCRSCode
sourceCRSCodeSource CRS code allocated by authority sourceCRSAuthName.
targetCRSAuthNameAuthority name of targetCRSCode
targetCRSCodeSource CRS code allocated by authority targetCRSAuthName.
usePROJAlternativeGridNamesWhether PROJ alternative grid names should be substituted to the official grid names.
discardIfMissingGridWhether coordinate operations that reference missing grids should be removed from the result set.
intermediateCRSAuthCodesList of (auth_name, code) of CRS that can be used as potential intermediate CRS. If the list is empty, the database will be used to find common CRS in operations involving both the source and target CRS.
Returns
list of coordinate operations
Exceptions
NoSuchAuthorityCodeException
FactoryException
crs::GeodeticCRSNNPtr osgeo::proj::io::AuthorityFactory::createGeodeticCRS ( const std::string &  code) const

Returns a crs::GeodeticCRS from the specified code.

Parameters
codeObject code allocated by authority.
Returns
object.
Exceptions
NoSuchAuthorityCodeException
FactoryException
datum::GeodeticReferenceFrameNNPtr osgeo::proj::io::AuthorityFactory::createGeodeticDatum ( const std::string &  code) const

Returns a datum::GeodeticReferenceFrame from the specified code.

Parameters
codeObject code allocated by authority.
Returns
object.
Exceptions
NoSuchAuthorityCodeException
FactoryException
crs::GeographicCRSNNPtr osgeo::proj::io::AuthorityFactory::createGeographicCRS ( const std::string &  code) const

Returns a crs::GeographicCRS from the specified code.

Parameters
codeObject code allocated by authority.
Returns
object.
Exceptions
NoSuchAuthorityCodeException
FactoryException
util::BaseObjectNNPtr osgeo::proj::io::AuthorityFactory::createObject ( const std::string &  code) const

Returns an arbitrary object from a code.

The returned object will typically be an instance of Datum, CoordinateSystem, ReferenceSystem or CoordinateOperation. If the type of the object is know at compile time, it is recommended to invoke the most precise method instead of this one (for example createCoordinateReferenceSystem(code) instead of createObject(code) if the caller know he is asking for a coordinate reference system).

If there are several objects with the same code, a FactoryException is thrown.

Parameters
codeObject code allocated by authority. (e.g. "4326")
Returns
object.
Exceptions
NoSuchAuthorityCodeException
FactoryException
datum::PrimeMeridianNNPtr osgeo::proj::io::AuthorityFactory::createPrimeMeridian ( const std::string &  code) const

Returns a datum::PrimeMeridian from the specified code.

Parameters
codeObject code allocated by authority.
Returns
object.
Exceptions
NoSuchAuthorityCodeException
FactoryException
crs::ProjectedCRSNNPtr osgeo::proj::io::AuthorityFactory::createProjectedCRS ( const std::string &  code) const

Returns a crs::ProjectedCRS from the specified code.

Parameters
codeObject code allocated by authority.
Returns
object.
Exceptions
NoSuchAuthorityCodeException
FactoryException
UnitOfMeasureNNPtr osgeo::proj::io::AuthorityFactory::createUnitOfMeasure ( const std::string &  code) const

Returns a common::UnitOfMeasure from the specified code.

Parameters
codeObject code allocated by authority.
Returns
object.
Exceptions
NoSuchAuthorityCodeException
FactoryException
crs::VerticalCRSNNPtr osgeo::proj::io::AuthorityFactory::createVerticalCRS ( const std::string &  code) const

Returns a crs::VerticalCRS from the specified code.

Parameters
codeObject code allocated by authority.
Returns
object.
Exceptions
NoSuchAuthorityCodeException
FactoryException
datum::VerticalReferenceFrameNNPtr osgeo::proj::io::AuthorityFactory::createVerticalDatum ( const std::string &  code) const

Returns a datum::VerticalReferenceFrame from the specified code.

Parameters
codeObject code allocated by authority.
Returns
object.
Exceptions
NoSuchAuthorityCodeException
FactoryException
const std::string & osgeo::proj::io::AuthorityFactory::getAuthority ( )

Returns the authority name associated to this factory.

Returns
name.
std::set< std::string > osgeo::proj::io::AuthorityFactory::getAuthorityCodes ( const ObjectType type,
bool  allowDeprecated = true 
) const

Returns the set of authority codes of the given object type.

Parameters
typeObject type.
allowDeprecatedwhether we should return deprecated objects as well.
Returns
the set of authority codes for spatial reference objects of the given type
Exceptions
FactoryException
std::string osgeo::proj::io::AuthorityFactory::getDescriptionText ( const std::string &  code) const

Gets a description of the object corresponding to a code.

Note
In case of several objects of different types with the same code, one of them will be arbitrarily selected.
Parameters
codeObject code allocated by authority. (e.g. "4326")
Returns
description.
Exceptions
NoSuchAuthorityCodeException
FactoryException
std::string osgeo::proj::io::AuthorityFactory::identifyBodyFromSemiMajorAxis ( double  semi_major_axis,
double  tolerance 
) const

Identify a celestial body from an approximate radius.

Parameters
semi_major_axisApproximate semi-major axis.
toleranceRelative error allowed.
Returns
celestial body name if one single match found.
Exceptions
FactoryException

The documentation for this class was generated from the following files: