QGIS API Documentation  3.24.2-Tisler (13c1a02865)
Classes | Public Types | Static Public Member Functions | List of all members
QgsProjUtils Class Reference

Utility functions for working with the proj library. More...

#include <qgsprojutils.h>

Classes

struct  ProjPJDeleter
 Destroys Proj PJ objects. More...
 

Public Types

enum  IdentifyFlag { FlagMatchBoundCrsToUnderlyingSourceCrs = 1 << 0 }
 Flags controlling CRS identification behavior. More...
 
using proj_pj_unique_ptr = std::unique_ptr< PJ, ProjPJDeleter >
 Scoped Proj PJ object. More...
 

Static Public Member Functions

static bool axisOrderIsSwapped (const PJ *crs)
 Returns true if the given proj coordinate system uses requires y/x coordinate order instead of x/y. More...
 
static bool coordinateOperationIsAvailable (const QString &projDef)
 Returns true if a coordinate operation (specified via proj string) is available. More...
 
static proj_pj_unique_ptr crsToDatumEnsemble (const PJ *crs)
 Given a PROJ crs, attempt to retrieve the datum ensemble from it. More...
 
static proj_pj_unique_ptr crsToSingleCrs (const PJ *crs)
 Given a PROJ crs (which may be a compound or bound crs, or some other type), extract a single crs from it. More...
 
static QDate epsgRegistryDate ()
 Returns the EPSG registry database release date used by the proj library. More...
 
static QString epsgRegistryVersion ()
 Returns the EPSG registry database version used by the proj library (e.g. More...
 
static QDate esriDatabaseDate ()
 Returns the ESRI projection engine database release date used by the proj library. More...
 
static QString esriDatabaseVersion ()
 Returns the ESRI projection engine database version used by the proj library (e.g. More...
 
static QList< QgsDatumTransform::GridDetailsgridsUsed (const QString &proj)
 Returns a list of grids used by the given proj string. More...
 
static bool identifyCrs (const PJ *crs, QString &authName, QString &authCode, IdentifyFlags flags=IdentifyFlags())
 Attempts to identify a crs, matching it to a known authority and code within an acceptable level of tolerance. More...
 
static QDate ignfDatabaseDate ()
 Returns the IGNF database release date used by the proj library. More...
 
static QString ignfDatabaseVersion ()
 Returns the IGNF database version used by the proj library (e.g. More...
 
static bool isDynamic (const PJ *crs)
 Returns true if the given proj coordinate system is a dynamic CRS. More...
 
static int projVersionMajor ()
 Returns the proj library major version number. More...
 
static int projVersionMinor ()
 Returns the proj library minor version number. More...
 
static QStringList searchPaths ()
 Returns the current list of Proj file search paths. More...
 
static bool usesAngularUnit (const QString &projDef)
 Returns true if the given proj coordinate system uses angular units. More...
 

Detailed Description

Utility functions for working with the proj library.

Since
QGIS 3.8

Definition at line 44 of file qgsprojutils.h.

Member Typedef Documentation

◆ proj_pj_unique_ptr

using QgsProjUtils::proj_pj_unique_ptr = std::unique_ptr< PJ, ProjPJDeleter >

Scoped Proj PJ object.

Definition at line 141 of file qgsprojutils.h.

Member Enumeration Documentation

◆ IdentifyFlag

Flags controlling CRS identification behavior.

Enumerator
FlagMatchBoundCrsToUnderlyingSourceCrs 

Allow matching a BoundCRS object to its underlying SourceCRS.

Definition at line 119 of file qgsprojutils.h.

Member Function Documentation

◆ axisOrderIsSwapped()

bool QgsProjUtils::axisOrderIsSwapped ( const PJ crs)
static

Returns true if the given proj coordinate system uses requires y/x coordinate order instead of x/y.

Definition at line 111 of file qgsprojutils.cpp.

◆ coordinateOperationIsAvailable()

bool QgsProjUtils::coordinateOperationIsAvailable ( const QString &  projDef)
static

Returns true if a coordinate operation (specified via proj string) is available.

Definition at line 290 of file qgsprojutils.cpp.

◆ crsToDatumEnsemble()

QgsProjUtils::proj_pj_unique_ptr QgsProjUtils::crsToDatumEnsemble ( const PJ crs)
static

Given a PROJ crs, attempt to retrieve the datum ensemble from it.

Warning
This method requires PROJ 8.0 or later
Exceptions
QgsNotSupportedExceptionon QGIS builds based on PROJ 7 or earlier.
Since
QGIS 3.20

Definition at line 219 of file qgsprojutils.cpp.

◆ crsToSingleCrs()

QgsProjUtils::proj_pj_unique_ptr QgsProjUtils::crsToSingleCrs ( const PJ crs)
static

Given a PROJ crs (which may be a compound or bound crs, or some other type), extract a single crs from it.

Definition at line 185 of file qgsprojutils.cpp.

◆ epsgRegistryDate()

QDate QgsProjUtils::epsgRegistryDate ( )
static

Returns the EPSG registry database release date used by the proj library.

See also
epsgRegistryVersion()
Since
QGIS 3.20

Definition at line 374 of file qgsprojutils.cpp.

◆ epsgRegistryVersion()

QString QgsProjUtils::epsgRegistryVersion ( )
static

Returns the EPSG registry database version used by the proj library (e.g.

"v9.8.6").

See also
epsgRegistryDate()
Since
QGIS 3.20

Definition at line 367 of file qgsprojutils.cpp.

◆ esriDatabaseDate()

QDate QgsProjUtils::esriDatabaseDate ( )
static

Returns the ESRI projection engine database release date used by the proj library.

See also
esriDatabaseVersion()
Since
QGIS 3.20

Definition at line 388 of file qgsprojutils.cpp.

◆ esriDatabaseVersion()

QString QgsProjUtils::esriDatabaseVersion ( )
static

Returns the ESRI projection engine database version used by the proj library (e.g.

"ArcMap 10.8.0").

See also
esriDatabaseDate()
Since
QGIS 3.20

Definition at line 381 of file qgsprojutils.cpp.

◆ gridsUsed()

QList< QgsDatumTransform::GridDetails > QgsProjUtils::gridsUsed ( const QString &  proj)
static

Returns a list of grids used by the given proj string.

Definition at line 303 of file qgsprojutils.cpp.

◆ identifyCrs()

bool QgsProjUtils::identifyCrs ( const PJ crs,
QString &  authName,
QString &  authCode,
IdentifyFlags  flags = IdentifyFlags() 
)
static

Attempts to identify a crs, matching it to a known authority and code within an acceptable level of tolerance.

Returns true if a matching authority and code was found.

Definition at line 236 of file qgsprojutils.cpp.

◆ ignfDatabaseDate()

QDate QgsProjUtils::ignfDatabaseDate ( )
static

Returns the IGNF database release date used by the proj library.

See also
ignfDatabaseVersion()
Since
QGIS 3.20

Definition at line 402 of file qgsprojutils.cpp.

◆ ignfDatabaseVersion()

QString QgsProjUtils::ignfDatabaseVersion ( )
static

Returns the IGNF database version used by the proj library (e.g.

"3.1.0").

See also
ignfDatabaseDate()
Since
QGIS 3.20

Definition at line 395 of file qgsprojutils.cpp.

◆ isDynamic()

bool QgsProjUtils::isDynamic ( const PJ crs)
static

Returns true if the given proj coordinate system is a dynamic CRS.

A dynamic CRS relies on a dynamic datum, that is a datum that is not plate-fixed.

Since
QGIS 3.20

Definition at line 142 of file qgsprojutils.cpp.

◆ projVersionMajor()

int QgsProjUtils::projVersionMajor ( )
static

Returns the proj library major version number.

Definition at line 357 of file qgsprojutils.cpp.

◆ projVersionMinor()

int QgsProjUtils::projVersionMinor ( )
static

Returns the proj library minor version number.

Since
QGIS 3.20

Definition at line 362 of file qgsprojutils.cpp.

◆ searchPaths()

QStringList QgsProjUtils::searchPaths ( )
static

Returns the current list of Proj file search paths.

Note
Only available on builds based on Proj >= 6.0. Builds based on earlier Proj versions will always return an empty list.

Definition at line 409 of file qgsprojutils.cpp.

◆ usesAngularUnit()

bool QgsProjUtils::usesAngularUnit ( const QString &  projDef)
static

Returns true if the given proj coordinate system uses angular units.

projDef must be a proj string defining a CRS object.

Definition at line 72 of file qgsprojutils.cpp.


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