Class: QgsCoordinateReferenceSystemRegistry

class qgis.core.QgsCoordinateReferenceSystemRegistry

Bases: PyQt5.QtCore.QObject

A registry for known coordinate reference system (CRS) definitions, including any user-defined CRSes.

QgsCoordinateReferenceSystemRegistry is not usually directly created, but rather accessed through QgsApplication.coordinateReferenceSystemRegistry().

New in version 3.18.

QgsCoordinateReferenceSystemRegistry(parent: QObject = None) Constructor for QgsCoordinateReferenceSystemRegistry, with the specified parent object.

Methods

addUserCrs

Adds a new crs definition as a custom ("USER") CRS.

authorities

Returns a list of all known authorities.

celestialBodies

Returns a list of all known celestial bodies.

childEvent

clearRecent

Cleans the list of recently used CRS.

connectNotify

customEvent

disconnectNotify

isSignalConnected

projOperations

Returns a map of all valid PROJ operations.

pushRecent

Pushes a recently used CRS to the top of the recent CRS list.

receivers

recentCrs

Returns a list of recently used CRS.

removeRecent

Removes a CRS from the list of recently used CRS.

removeUserCrs

Removes the existing user CRS with matching id.

sender

senderSignalIndex

timerEvent

updateUserCrs

Updates the definition of the existing user CRS with matching id.

userCrsList

Returns a list containing the details of all registered custom (user-defined) CRSes.

Signals

crsDefinitionsChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

recentCrsCleared

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

recentCrsPushed

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

recentCrsRemoved

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

userCrsAdded

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

userCrsChanged

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

userCrsRemoved

pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL

class UserCrsDetails

Bases: sip.wrapper

Contains details of a custom (user defined) CRS.

New in version 3.18.

crs
id
name
proj
wkt
addUserCrs(self, crs: QgsCoordinateReferenceSystem, name: str, nativeFormat: Qgis.CrsDefinitionFormat = Qgis.CrsDefinitionFormat.Wkt) int

Adds a new crs definition as a custom (“USER”) CRS.

Returns the new CRS srsid(), or -1 if the CRS could not be saved.

The nativeFormat argument specifies the format to use when saving the CRS definition. FormatWkt is recommended as it is a lossless format.

Warning

Not all CRS definitions can be represented as a Proj string, so take care when using the FormatProj option.

See also

updateUserCrs()

See also

userCrsAdded()

Parameters:
Return type:

int

authorities(self) Set[str]

Returns a list of all known authorities.

Note

authority names will always be returned in lower case

New in version 3.34.

Return type:

Set[str]

celestialBodies(self) List[QgsCelestialBody]

Returns a list of all known celestial bodies.

Warning

This method requires PROJ 8.1 or later

Raises:

QgsNotSupportedException – on QGIS builds based on PROJ 8.0 or earlier.

New in version 3.20.

Return type:

List[QgsCelestialBody]

childEvent(self, QChildEvent)
clearRecent(self)

Cleans the list of recently used CRS.

New in version 3.36.

connectNotify(self, QMetaMethod)
crsDefinitionsChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

customEvent(self, QEvent)
disconnectNotify(self, QMetaMethod)
isSignalConnected(self, QMetaMethod) bool
projOperations(self) Dict[str, QgsProjOperation]

Returns a map of all valid PROJ operations.

The map keys correspond to PROJ operation IDs.

New in version 3.20.

Return type:

Dict[str, QgsProjOperation]

pushRecent(self, crs: QgsCoordinateReferenceSystem)

Pushes a recently used CRS to the top of the recent CRS list.

New in version 3.16.

Parameters:

crs (QgsCoordinateReferenceSystem) –

receivers(self, PYQT_SIGNAL) int
recentCrs(self) List[QgsCoordinateReferenceSystem]

Returns a list of recently used CRS.

New in version 3.36.

Return type:

List[QgsCoordinateReferenceSystem]

recentCrsCleared

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

recentCrsPushed

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

recentCrsRemoved

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

removeRecent(self, crs: QgsCoordinateReferenceSystem)

Removes a CRS from the list of recently used CRS.

New in version 3.36.

Parameters:

crs (QgsCoordinateReferenceSystem) –

removeUserCrs(self, id: int) bool

Removes the existing user CRS with matching id.

Returns False if the CRS could not be removed.

See also

userCrsRemoved()

Parameters:

id (int) –

Return type:

bool

sender(self) QObject
senderSignalIndex(self) int
timerEvent(self, QTimerEvent)
updateUserCrs(self, id: int, crs: QgsCoordinateReferenceSystem, name: str, nativeFormat: Qgis.CrsDefinitionFormat = Qgis.CrsDefinitionFormat.Wkt) bool

Updates the definition of the existing user CRS with matching id.

The crs argument specifies a CRS with the desired new definition.

Returns False if the new CRS definition could not be saved.

The nativeFormat argument specifies the format to use when saving the CRS definition. FormatWkt is recommended as it is a lossless format.

Warning

Not all CRS definitions can be represented as a Proj string, so take care when using the FormatProj option.

See also

addUserCrs()

See also

userCrsChanged()

Parameters:
  • id (int) –

  • crs (QgsCoordinateReferenceSystem) –

  • name (str) –

  • nativeFormat (Qgis.CrsDefinitionFormat = Qgis.CrsDefinitionFormat.Wkt) –

Return type:

bool

userCrsAdded

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

userCrsChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

userCrsList(self) List[QgsCoordinateReferenceSystemRegistry.UserCrsDetails]

Returns a list containing the details of all registered custom (user-defined) CRSes.

Return type:

List[QgsCoordinateReferenceSystemRegistry.UserCrsDetails]

userCrsRemoved

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL