Class: QgsCoordinateReferenceSystemRegistry¶
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().
Added in version 3.18.
Class Hierarchy¶
Base classes¶
- class qgis.core.QgsCoordinateReferenceSystemRegistry[source]¶
Bases:
QObject- __init__(parent: QObject | None = None)
Constructor for QgsCoordinateReferenceSystemRegistry, with the specified
parentobject.- Parameters:
parent (Optional[QObject] = None)
- class UserCrsDetails[source]¶
Bases:
objectContains details of a custom (user defined) CRS.
Added in version 3.18.
- id: int¶
- name: str¶
- proj: str¶
- wkt: str¶
- addUserCrs(self, crs: QgsCoordinateReferenceSystem, name: str | None, nativeFormat: Qgis.CrsDefinitionFormat = Qgis.CrsDefinitionFormat.Wkt) int[source]¶
Adds a new
crsdefinition as a custom (“USER”) CRS.Returns the new CRS
srsid(), or -1 if the CRS could not be saved.The
nativeFormatargument 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
See also
- Parameters:
name (Optional[str])
nativeFormat (Qgis.CrsDefinitionFormat = Qgis.CrsDefinitionFormat.Wkt)
- Return type:
int
- authorities(self) Set[str]¶
Returns a list of all known authorities.
Note
authority names will always be returned in lower case
Added in version 3.34.
- Return type:
Set[str]
- celestialBodies(self) List[QgsCelestialBody]¶
Returns a list of all known celestial bodies.
Added in version 3.20.
- Return type:
- signal crsDefinitionsChanged[source]¶
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.
- projOperations(self) Dict[str, QgsProjOperation]¶
Returns a map of all valid PROJ operations.
The map keys correspond to PROJ operation IDs.
Added in version 3.20.
- Return type:
Dict[str, QgsProjOperation]
- pushRecent(self, crs: QgsCoordinateReferenceSystem)[source]¶
Pushes a recently used CRS to the top of the recent CRS list.
See also
Added in version 3.16.
- Parameters:
- recentCrs(self) List[QgsCoordinateReferenceSystem]¶
Returns a list of recently used CRS.
Added in version 3.36.
- Return type:
- signal recentCrsCleared[source]¶
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.
- signal recentCrsPushed[source]¶
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.
- signal recentCrsRemoved[source]¶
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.
- removeRecent(self, crs: QgsCoordinateReferenceSystem)[source]¶
Removes a CRS from the list of recently used CRS.
See also
Added in version 3.36.
- Parameters:
- removeUserCrs(self, id: int) bool[source]¶
Removes the existing user CRS with matching
id.Returns
Falseif the CRS could not be removed.See also
- Parameters:
id (int)
- Return type:
bool
- updateUserCrs(self, id: int, crs: QgsCoordinateReferenceSystem, name: str | None, nativeFormat: Qgis.CrsDefinitionFormat = Qgis.CrsDefinitionFormat.Wkt) bool[source]¶
Updates the definition of the existing user CRS with matching
id.The
crsargument specifies a CRS with the desired new definition.Returns
Falseif the new CRS definition could not be saved.The
nativeFormatargument 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
See also
- Parameters:
id (int)
name (Optional[str])
nativeFormat (Qgis.CrsDefinitionFormat = Qgis.CrsDefinitionFormat.Wkt)
- Return type:
bool
- signal userCrsAdded[source]¶
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.
- signal userCrsChanged[source]¶
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.
- userCrsList(self) List[QgsCoordinateReferenceSystemRegistry.UserCrsDetails]¶
Returns a list containing the details of all registered custom (user-defined) CRSes.
- Return type:
- signal userCrsRemoved[source]¶
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.