Skip to content

crs

crs

This module contains the crs handling shared by the exporter and the worker. It is the only place where QGIS crs information is translated into the QGIS-Server-Light interface.

create_qsl_crs(crs: QgsCoordinateReferenceSystem) -> Crs

Translates a QGIS crs into an instance of the QGIS-Server-Light interface Crs.

Parameters:

  • crs (QgsCoordinateReferenceSystem) –

    The QGIS crs to take the information from.

Returns:

  • Crs –

    The instance of the QSL interface Crs.

Source code in src/qgis_server_light/crs.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
def create_qsl_crs(crs: QgsCoordinateReferenceSystem) -> Crs:
    """
    Translates a QGIS crs into an instance of the QGIS-Server-Light interface Crs.

    Args:
        crs: The QGIS crs to take the information from.

    Returns:
        The instance of the QSL interface Crs.
    """
    return Crs(
        postgis_srid=crs.postgisSrid(),
        auth_id=crs.authid(),
        ogc_uri=crs.toOgcUri(),
        ogc_urn=crs.toOgcUrn(),
        axis_inverted=crs.hasAxisInverted(),
    )