Class: QgsCoordinateReferenceSystemModel

A tree model for display of known coordinate reference systems.

Added in version 3.34.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsCoordinateReferenceSystemModel

Base classes

QAbstractItemModel

QObject

Enums

CustomRole

Custom model roles.

Roles

alias of CustomRole

Methods

addCustomCrs

Adds a custom crs to the model.

authIdToIndex

Retrieves the model index corresponding to a CRS with the specified authId.

class qgis.gui.QgsCoordinateReferenceSystemModel[source]

Bases: QAbstractItemModel

__init__(parent: QObject | None = None)

Constructor for QgsCoordinateReferenceSystemModel, with the specified parent object.

Parameters:

parent (Optional[QObject] = None)

class CustomRole(*values)

Bases: IntEnum

Custom model roles.

Note

Prior to QGIS 3.36 this was available as QgsCoordinateReferenceSystemModel.Roles

Added in version 3.36.

  • NodeType: Corresponds to the node’s type

    Available as QgsCoordinateReferenceSystemModel.RoleNodeType in older QGIS releases.

  • Name: The coordinate reference system name

    Available as QgsCoordinateReferenceSystemModel.RoleName in older QGIS releases.

  • AuthId: The coordinate reference system authority name and id

    Available as QgsCoordinateReferenceSystemModel.RoleAuthId in older QGIS releases.

  • Deprecated: True if the CRS is deprecated

    Available as QgsCoordinateReferenceSystemModel.RoleDeprecated in older QGIS releases.

  • Type: The coordinate reference system type

    Available as QgsCoordinateReferenceSystemModel.RoleType in older QGIS releases.

  • GroupId: The node ID (for group nodes)

    Available as QgsCoordinateReferenceSystemModel.RoleGroupId in older QGIS releases.

  • Wkt: The coordinate reference system’s WKT representation. This is only used for non-standard CRS (i.e. those not present in the database).

    Available as QgsCoordinateReferenceSystemModel.RoleWkt in older QGIS releases.

  • Proj: The coordinate reference system’s PROJ representation. This is only used for non-standard CRS (i.e. those not present in the database).

    Available as QgsCoordinateReferenceSystemModel.RoleProj in older QGIS releases.

  • Group: Group name.

    Added in version 3.42.

  • Projection: Projection name.

    Added in version 3.42.

Roles

alias of CustomRole

addCustomCrs(self, crs: QgsCoordinateReferenceSystem) QModelIndex[source]

Adds a custom crs to the model.

This method can be used to add CRS which aren’t present in either the standard PROJ SRS database or the user’s custom CRS database to the model.

Parameters:

crs (QgsCoordinateReferenceSystem)

Return type:

QModelIndex

authIdToIndex(self, authId: str | None) QModelIndex[source]

Retrieves the model index corresponding to a CRS with the specified authId.

Returns an invalid index if the CRS was not found.

Parameters:

authId (Optional[str])

Return type:

QModelIndex