Skip to content

job

job

common

input

AbstractFilter dataclass

Bases: BaseInterface

Source code in src/qgis_server_light/interface/job/common/input.py
66
67
68
69
70
71
72
@dataclass(repr=False)
class AbstractFilter(BaseInterface):
    definition: str = field(metadata={"type": "Element"})

    @property
    def shortened_fields(self) -> set:
        return {"definition"}
definition: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
shortened_fields: set property
__init__(definition: str) -> None
ExecutionMode

Bases: Enum

If the dispatcher waits for the job (SYNC) or asks for its state later (ASYNC). Only jobs which keep their state (RedisStateProtocol) use it.

Source code in src/qgis_server_light/interface/job/common/input.py
17
18
19
20
21
22
23
class ExecutionMode(Enum):
    """If the dispatcher waits for the job (`SYNC`) or asks for its state later
    (`ASYNC`). Only jobs which keep their state (`RedisStateProtocol`) use it.
    """

    SYNC = "sync"
    ASYNC = "async"
ASYNC = 'async' class-attribute instance-attribute
SYNC = 'sync' class-attribute instance-attribute
OgcFilter110 dataclass

Bases: AbstractFilter

A filter which definition conforms to https://schemas.opengis.net/filter/1.1.0/filter.xsd and which is consumable by qgis.core.QgsOgcUtils.expressionFromOgcFilter.

Source code in src/qgis_server_light/interface/job/common/input.py
75
76
77
78
79
80
81
@dataclass(repr=False)
class OgcFilter110(AbstractFilter):
    """
    A filter which definition conforms to
    https://schemas.opengis.net/filter/1.1.0/filter.xsd
    and which is consumable by `qgis.core.QgsOgcUtils.expressionFromOgcFilter`.
    """
__init__(definition: str) -> None
OgcFilterFES20 dataclass

Bases: AbstractFilter

A filter which definition conforms to https://www.opengis.net/fes/2.0 and which is consumable by qgis.core.QgsOgcUtils.expressionFromOgcFilter.

Source code in src/qgis_server_light/interface/job/common/input.py
84
85
86
87
88
89
@dataclass(repr=False)
class OgcFilterFES20(AbstractFilter):
    """
    A filter which definition conforms to https://www.opengis.net/fes/2.0
    and which is consumable by `qgis.core.QgsOgcUtils.expressionFromOgcFilter`.
    """
__init__(definition: str) -> None
QslJobInfoParameter dataclass

Bases: ABC

The common minimal interface of a job which is shipped around. Each job for QSL has to implement at least this interface.

Attributes:

  • id (str) –

    The unique identifier which is used to recognize the job all over its lifecycle.

  • type (str) –

    A string based identifier of the job, this is used to quickly determine its nature serialized state.

  • job (QslJobParameter) –

    The actual job parameters. This is a domain specific dataclass depending on the nature of the actual job.

  • execution_mode (ExecutionMode) –

    With ExecutionMode.SYNC the worker notifies the waiting dispatcher when the job is finished. Only used by jobs which keep their state.

Source code in src/qgis_server_light/interface/job/common/input.py
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
@dataclass
class QslJobInfoParameter(ABC):  # noqa: B024
    """The common minimal interface of a job which is
    shipped around. Each job for QSL has to implement at least this
    interface.

    Attributes:
        id: The unique identifier which is used to recognize the job
            all over its lifecycle.
        type: A string based identifier of the job, this is used to quickly
            determine its nature serialized state.
        job: The actual job parameters. This is a domain specific dataclass
            depending on the nature of the actual job.
        execution_mode: With `ExecutionMode.SYNC` the worker notifies the waiting
            dispatcher when the job is finished. Only used by jobs which keep their
            state.
    """

    id: str = field(metadata={"type": "Element"})
    type: str = field(metadata={"type": "Element"})
    job: QslJobParameter = field(metadata={"type": "Element"})
    execution_mode: ExecutionMode = field(metadata={"type": "Element"}, default=ExecutionMode.SYNC)

    @property
    def channel_name(self) -> str:
        return f"notification_{self.execution_mode.value}"
channel_name: str property
execution_mode: ExecutionMode = field(metadata={'type': 'Element'}, default=(ExecutionMode.SYNC)) class-attribute instance-attribute
id: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
job: QslJobParameter = field(metadata={'type': 'Element'}) class-attribute instance-attribute
type: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(id: str, type: str, job: QslJobParameter, execution_mode: ExecutionMode = ExecutionMode.SYNC) -> None
QslJobLayer dataclass

Bases: BaseInterface

Source code in src/qgis_server_light/interface/job/common/input.py
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
@dataclass(repr=False)
class QslJobLayer(BaseInterface):
    id: str = field(metadata={"type": "Element"})
    name: str = field(metadata={"type": "Element"})
    source: str = field(metadata={"type": "Element"})
    remote: bool = field(metadata={"type": "Element"})
    folder_name: str = field(metadata={"type": "Element"})
    driver: str = field(metadata={"type": "Element"})
    style: Style | None = field(default=None, metadata={"type": "Element"})
    filter: OgcFilter110 | OgcFilterFES20 | None = field(default=None, metadata={"type": "Element"})

    @property
    def redacted_fields(self) -> set:
        return {"source"}
driver: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
filter: OgcFilter110 | OgcFilterFES20 | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
folder_name: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
id: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
name: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
redacted_fields: set property
remote: bool = field(metadata={'type': 'Element'}) class-attribute instance-attribute
source: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
style: Style | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(id: str, name: str, source: str, remote: bool, folder_name: str, driver: str, style: Style | None = None, filter: OgcFilter110 | OgcFilterFES20 | None = None) -> None
QslJobParameter dataclass

Bases: ABC

The minimal interface of a job parameter interface. In the domain specific refinement it holds the relevant information about a job.

Source code in src/qgis_server_light/interface/job/common/input.py
 8
 9
10
11
12
13
14
@dataclass
class QslJobParameter(ABC):  # noqa: B024
    """The minimal interface of a job parameter interface. In the domain
    specific refinement it holds the relevant information about a job.
    """

    pass
__init__() -> None
QslJobParameterMapRelated dataclass

Bases: QslJobParameter

The minimal interface of a job parameter interface for jobs rendering things in the end.

Attributes:

  • svg_paths (list[str]) –

    A list of paths to svg's (folders) which are necessary for the job to render nicely.

Source code in src/qgis_server_light/interface/job/common/input.py
54
55
56
57
58
59
60
61
62
63
@dataclass
class QslJobParameterMapRelated(QslJobParameter):
    """The minimal interface of a job parameter interface for jobs rendering things in the end.

    Attributes:
        svg_paths: A list of paths to svg's (folders) which are necessary for
            the job to render nicely.
    """

    svg_paths: list[str] = field(default_factory=list, metadata={"type": "Element"})
svg_paths: list[str] = field(default_factory=list, metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(svg_paths: list[str] = list()) -> None

output

JobResult dataclass

Bases: BaseInterface

Source code in src/qgis_server_light/interface/job/common/output.py
 7
 8
 9
10
11
12
13
14
15
16
17
@dataclass
class JobResult(BaseInterface):
    id: str = field(metadata={"type": "Element"})
    data: Any = field(metadata={"type": "Element"})
    content_type: str = field(metadata={"type": "Element"})
    worker_id: str | None = field(default=None, metadata={"type": "Element"})
    worker_host_name: str | None = field(default=None, metadata={"type": "Element"})

    @property
    def shortened_fields(self) -> set:
        return {"data"}
content_type: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
data: Any = field(metadata={'type': 'Element'}) class-attribute instance-attribute
id: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
shortened_fields: set property
worker_host_name: str | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
worker_id: str | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(id: str, data: Any, content_type: str, worker_id: str | None = None, worker_host_name: str | None = None) -> None

crs

input

QslJobInfoCrs dataclass

Bases: QslJobInfoParameter

Source code in src/qgis_server_light/interface/job/crs/input.py
22
23
24
@dataclass
class QslJobInfoCrs(QslJobInfoParameter):
    job: QslJobParameterCrs = field(metadata={"type": "Element"})
job: QslJobParameterCrs = field(metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(id: str, type: str, job: QslJobParameterCrs, execution_mode: ExecutionMode = ExecutionMode.SYNC) -> None
QslJobParameterCrs dataclass

Bases: QslJobParameter

Resolves crs identifiers into the full crs information as QGIS knows it. This way consuming applications get all identifiers and the axis order without own crs knowledge.

Attributes:

  • identifiers (list[str]) –

    The crs identifiers to resolve, e.g. EPSG:4326, URN or URI notation.

Source code in src/qgis_server_light/interface/job/crs/input.py
 9
10
11
12
13
14
15
16
17
18
19
@dataclass
class QslJobParameterCrs(QslJobParameter):
    """Resolves crs identifiers into the full crs information as QGIS knows it. This way
    consuming applications get all identifiers and the axis order without own crs
    knowledge.

    Attributes:
        identifiers: The crs identifiers to resolve, e.g. `EPSG:4326`, URN or URI notation.
    """

    identifiers: list[str] = field(metadata={"type": "Element"})
identifiers: list[str] = field(metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(identifiers: list[str]) -> None

output

CrsCollection dataclass

Bases: BaseInterface

Holds the resolved crs. The order in the list has to be not changed, so that consuming applications can map the response to the passed identifiers.

Attributes:

  • crs (list[Crs]) –

    The resolved crs in the order of the passed identifiers.

Source code in src/qgis_server_light/interface/job/crs/output.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
@dataclass(repr=False)
class CrsCollection(BaseInterface):
    """Holds the resolved crs. The order in the list has to be not changed, so that
    consuming applications can map the response to the passed identifiers.

    Attributes:
        crs: The resolved crs in the order of the passed identifiers.
    """

    crs: list[Crs] = field(
        default_factory=list,
        metadata={"type": "Element"},
    )
crs: list[Crs] = field(default_factory=list, metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(crs: list[Crs] = list()) -> None

feature

input

FeatureQuery dataclass

Bases: BaseInterface

Represents definitions of a query to obtain features from a list of layers. Be aware, that filters are not applied to the QslJobLayer in this implementation since passed filters can contain inter-layer-references.

Attributes:

  • layers (list[QslJobLayer]) –

    A list layers which should only reference vector sources and be queried.

  • aliases (list[str]) –

    An optional list of alias names. This has to be the same length as the

  • filter (OgcFilterFES20) –

    An optional filter which might reference all passed layers thats why layers has to be added

  • crs (Crs | None) –

    An optional crs the geometries of the features are transformed to. If not set, geometries stay in the crs of the layer.

Source code in src/qgis_server_light/interface/job/feature/input.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
@dataclass
class FeatureQuery(BaseInterface):
    """Represents definitions of a query to obtain features from a list of layers.
    Be aware, that filters are not applied to the QslJobLayer in this implementation
    since passed filters can contain inter-layer-references.

    Attributes:
        layers: A list layers which should only reference vector sources and be queried.
        aliases: An optional list of alias names. This has to be the same length as the
        list of datasets.
        filter: An optional filter which might reference all passed layers thats why layers
            has to be added
        crs: An optional crs the geometries of the features are transformed to. If not
            set, geometries stay in the crs of the layer.
    """

    layers: list[QslJobLayer] = field(metadata={"type": "Element"})
    aliases: list[str] = field(default_factory=list, metadata={"type": "Element"})
    filter: OgcFilterFES20 = field(default=None, metadata={"type": "Element"})
    crs: Crs | None = field(default=None, metadata={"type": "Element"})
aliases: list[str] = field(default_factory=list, metadata={'type': 'Element'}) class-attribute instance-attribute
crs: Crs | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
filter: OgcFilterFES20 = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
layers: list[QslJobLayer] = field(metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(layers: list[QslJobLayer], aliases: list[str] = list(), filter: OgcFilterFES20 = None, crs: Crs | None = None) -> None
QslJobInfoFeature dataclass

Bases: QslJobInfoParameter

Source code in src/qgis_server_light/interface/job/feature/input.py
60
61
62
@dataclass
class QslJobInfoFeature(QslJobInfoParameter):
    job: QslJobParameterFeature = field(metadata={"type": "Element"})
job: QslJobParameterFeature = field(metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(id: str, type: str, job: QslJobParameterFeature, execution_mode: ExecutionMode = ExecutionMode.SYNC) -> None
QslJobParameterFeature dataclass

Bases: QslJobParameter

As defined in WFS 2.0 specs, a request can be subdivided in a list of queries. This class is representing that.

Attributes:

  • queries (list[FeatureQuery]) –

    A list of queries which features should be extracted for.

  • start_index (int) –

    The offset for paging reason.

  • count (int | None) –

    The number of results to return.

Source code in src/qgis_server_light/interface/job/feature/input.py
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
@dataclass
class QslJobParameterFeature(QslJobParameter):
    """As defined in WFS 2.0 specs, a request can be subdivided in a list of queries.
    This class is representing that.

    Attributes:
        queries: A list of queries which features should be extracted for.
        start_index: The offset for paging reason.
        count: The number of results to return.
    """

    queries: list[FeatureQuery] = field(metadata={"type": "Element"})
    start_index: int = field(
        default=0,
        metadata={
            "type": "Element",
        },
    )
    count: int | None = field(
        default=None,
        metadata={
            "type": "Element",
        },
    )
count: int | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
queries: list[FeatureQuery] = field(metadata={'type': 'Element'}) class-attribute instance-attribute
start_index: int = field(default=0, metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(queries: list[FeatureQuery], start_index: int = 0, count: int | None = None) -> None

output

Attribute dataclass

Bases: BaseInterface

An attribute belonging to a feature. The aim here is to drill down to simple types which can be used in consuming applications without further handling. This does not include the geometry attribute!

Attributes:

  • name (str) –

    The name of the attribute. Has to match with the name used for exported fields with Field class.

  • value (int | float | str | bool | bytes | None) –

    Value as simple as possible. It has to be pickleable

Source code in src/qgis_server_light/interface/job/feature/output.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
@dataclass(repr=False)
class Attribute(BaseInterface):
    """An attribute belonging to a feature. The aim here is to
    drill down to simple types which can be used in consuming
    applications without further handling. This does not include
    the geometry attribute!

    Attributes:
        name: The name of the attribute. Has to match with the
            name used for exported fields with `Field` class.
        value: Value as simple as possible. It has to be
            [pickleable](https://docs.python.org/3/library/pickle.html#what-can-be-pickled-and-unpickled)

    """

    name: str = field(metadata={"type": "Element"})
    value: int | float | str | bool | bytes | None = field(
        metadata={"type": "Element", "format": "base64"}
    )
name: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
value: int | float | str | bool | bytes | None = field(metadata={'type': 'Element', 'format': 'base64'}) class-attribute instance-attribute
__init__(name: str, value: int | float | str | bool | bytes | None) -> None
Feature dataclass

Bases: BaseInterface

Feature to hold information of extracted QgsFeature.

Attributes:

Source code in src/qgis_server_light/interface/job/feature/output.py
37
38
39
40
41
42
43
44
45
46
47
48
49
50
@dataclass(repr=False)
class Feature(BaseInterface):
    """Feature to hold information of extracted QgsFeature.

    Attributes:
        geometry: The geometry representing the feature.
        attributes: List of attributes defined in this feature.
    """

    geometry: Geometry | None = field(default=None, metadata={"type": "Element"})
    attributes: list[Attribute] = field(
        default_factory=list,
        metadata={"type": "Element"},
    )
attributes: list[Attribute] = field(default_factory=list, metadata={'type': 'Element'}) class-attribute instance-attribute
geometry: Geometry | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(geometry: Geometry | None = None, attributes: list[Attribute] = list()) -> None
FeatureCollection dataclass

Bases: BaseInterface

This construction is used to abstract the content of extracted features for pickelable transportation from QSL to the queue. This way we ensure how things are constructed and transported.

Attributes:

  • name (str) –

    The name of the feature collection. This is the key to match it to requested layers.

  • features (list[Feature]) –

    The features belonging to the feature collection.

Source code in src/qgis_server_light/interface/job/feature/output.py
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
@dataclass(repr=False)
class FeatureCollection(BaseInterface):
    """This construction is used to abstract the content of extracted
    features for pickelable transportation from QSL to the queue.
    This way we ensure how things are constructed and transported.

    Attributes:
        name: The name of the feature collection. This is the key to
            match it to requested layers.
        features: The features belonging to the feature collection.
    """

    name: str = field(metadata={"type": "Element"})
    features: list[Feature] = field(
        default_factory=list,
        metadata={"type": "Element"},
    )
features: list[Feature] = field(default_factory=list, metadata={'type': 'Element'}) class-attribute instance-attribute
name: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(name: str, features: list[Feature] = list()) -> None
Geometry dataclass

Bases: Attribute

Source code in src/qgis_server_light/interface/job/feature/output.py
27
28
29
30
31
32
33
34
@dataclass(repr=False)
class Geometry(Attribute):
    name: str = field(default="geometry", metadata={"type": "Element"})
    value: bytes | None = field(default=None, metadata={"type": "Element", "format": "base64"})

    @property
    def shortened_fields(self) -> set:
        return {"value"}
name: str = field(default='geometry', metadata={'type': 'Element'}) class-attribute instance-attribute
shortened_fields: set property
value: bytes | None = field(default=None, metadata={'type': 'Element', 'format': 'base64'}) class-attribute instance-attribute
__init__(name: str = 'geometry', value: bytes | None = None) -> None
QueryCollection dataclass

Bases: BaseInterface

Holds all feature collections which are bound to the passed queries. The order in the list has to be not changed, so that consuming applications can map the response to the passed queries.

Attributes:

Source code in src/qgis_server_light/interface/job/feature/output.py
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
@dataclass(repr=False)
class QueryCollection(BaseInterface):
    """Holds all feature collections which are bound to the
    passed queries. The order in the list has to be not changed,
    so that consuming applications can map the response to the
    passed queries.

    Attributes:
        numbers_matched: Information about how many matches are fund for the executed query.
        feature_collections: The feature collections belonging to the passed queries.
    """

    numbers_matched: str | int = field(
        default="unknown",
        metadata={"type": "Element"},
    )
    feature_collections: list[FeatureCollection] = field(
        default_factory=list,
        metadata={"type": "Element"},
    )
feature_collections: list[FeatureCollection] = field(default_factory=list, metadata={'type': 'Element'}) class-attribute instance-attribute
numbers_matched: str | int = field(default='unknown', metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(numbers_matched: str | int = 'unknown', feature_collections: list[FeatureCollection] = list()) -> None

feature_info

input

QslJobInfoFeatureInfo dataclass

Bases: QslJobInfoParameter

Source code in src/qgis_server_light/interface/job/feature_info/input.py
42
43
44
@dataclass
class QslJobInfoFeatureInfo(QslJobInfoParameter):
    job: QslJobParameterFeatureInfo = field(metadata={"type": "Element", "required": True})
job: QslJobParameterFeatureInfo = field(metadata={'type': 'Element', 'required': True}) class-attribute instance-attribute
__init__(id: str, type: str, job: QslJobParameterFeatureInfo, execution_mode: ExecutionMode = ExecutionMode.SYNC) -> None
QslJobParameterFeatureInfo dataclass

Bases: QslJobParameter

A runner to extract feature info

Source code in src/qgis_server_light/interface/job/feature_info/input.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
@dataclass(kw_only=True)
class QslJobParameterFeatureInfo(QslJobParameter):
    """A runner to extract feature info"""

    # mime type, only application/json supported
    INFO_FORMAT: str = field(metadata={"type": "Element"})
    QUERY_LAYERS: str = field(metadata={"type": "Element"})
    X: str | None = field(default=None, metadata={"type": "Element"})
    Y: str | None = field(default=None, metadata={"type": "Element"})
    I: str | None = field(default=None, metadata={"type": "Element"})  # noqa: E741
    J: str | None = field(default=None, metadata={"type": "Element"})

    def __post_init__(self):
        x = int(self.I or self.X)
        y = int(self.J or self.Y)
        if x is None or y is None:
            raise KeyError("Parameter `I` or `X` and `J` or `Y`  are mandatory for GetFeatureInfo")
        if self.QUERY_LAYERS is None:
            raise KeyError("QUERY_LAYERS is mandatory in this request")

    @property
    def decide_x(self) -> int:
        return int(self.I or self.X)

    @property
    def decide_y(self) -> int:
        return int(self.J or self.Y)

    @property
    def query_layers_list(self):
        return self.QUERY_LAYERS.split(",")
I: str | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
INFO_FORMAT: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
J: str | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
QUERY_LAYERS: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
X: str | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
Y: str | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
decide_x: int property
decide_y: int property
query_layers_list property
__init__(*, INFO_FORMAT: str, QUERY_LAYERS: str, X: str | None = None, Y: str | None = None, I: str | None = None, J: str | None = None) -> None
__post_init__()
Source code in src/qgis_server_light/interface/job/feature_info/input.py
21
22
23
24
25
26
27
def __post_init__(self):
    x = int(self.I or self.X)
    y = int(self.J or self.Y)
    if x is None or y is None:
        raise KeyError("Parameter `I` or `X` and `J` or `Y`  are mandatory for GetFeatureInfo")
    if self.QUERY_LAYERS is None:
        raise KeyError("QUERY_LAYERS is mandatory in this request")

output

legend

input

QslJobInfoLegend dataclass

Bases: QslJobInfoParameter

Source code in src/qgis_server_light/interface/job/legend/input.py
29
30
31
@dataclass
class QslJobInfoLegend(QslJobInfoParameter):
    job: QslJobParameterLegend = field(metadata={"type": "Element", "required": True})
job: QslJobParameterLegend = field(metadata={'type': 'Element', 'required': True}) class-attribute instance-attribute
__init__(id: str, type: str, job: QslJobParameterLegend, execution_mode: ExecutionMode = ExecutionMode.SYNC) -> None
QslJobParameterLegend dataclass

Bases: QslJobParameter

Render legend graphics for one or more layers.

Source code in src/qgis_server_light/interface/job/legend/input.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
@dataclass(kw_only=True)
class QslJobParameterLegend(QslJobParameter):
    """Render legend graphics for one or more layers."""

    layers: list[QslJobLayer] = field(metadata={"type": "Element"})
    format: str = field(default="image/png", metadata={"type": "Element"})
    width: int | None = field(default=None, metadata={"type": "Element"})
    height: int | None = field(default=None, metadata={"type": "Element"})
    dpi: int = field(default=91, metadata={"type": "Element"})
    scale: float | None = field(default=None, metadata={"type": "Element"})
    layer_title: bool = field(default=False, metadata={"type": "Element"})

    def get_layer_by_name(self, name: str) -> QslJobLayer:
        for layer in self.layers:
            if layer.name == name:
                return layer
        raise LookupError(f'No layer with name "{name}" was found.')
dpi: int = field(default=91, metadata={'type': 'Element'}) class-attribute instance-attribute
format: str = field(default='image/png', metadata={'type': 'Element'}) class-attribute instance-attribute
height: int | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
layer_title: bool = field(default=False, metadata={'type': 'Element'}) class-attribute instance-attribute
layers: list[QslJobLayer] = field(metadata={'type': 'Element'}) class-attribute instance-attribute
scale: float | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
width: int | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(*, layers: list[QslJobLayer], format: str = 'image/png', width: int | None = None, height: int | None = None, dpi: int = 91, scale: float | None = None, layer_title: bool = False) -> None
get_layer_by_name(name: str) -> QslJobLayer
Source code in src/qgis_server_light/interface/job/legend/input.py
22
23
24
25
26
def get_layer_by_name(self, name: str) -> QslJobLayer:
    for layer in self.layers:
        if layer.name == name:
            return layer
    raise LookupError(f'No layer with name "{name}" was found.')

output

process

description

This module contains the description of the processes a process-worker serves. It is shaped along the process description of OGC API - Processes - Part 1: Core (https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/schemas/process.yaml), so a consumer can expose its elements as they are and only adds what belongs to the API around (links, job control options, conformance, ...).

Optional values default to None. Serialized with xsdata.formats.dataclass.serializers.dict.DictFactory.FILTER_NONE they are left out, which gives a plain JSON Schema for each Schema.

QSL_LAYER_FORMAT = 'qsl-layer' module-attribute
InputDescription dataclass

Bases: BaseInterface

The description of one input of a process.

OGC API - Processes holds the inputs as map by id. xsdata can't bind a map of dataclasses, therefore the id is part of the description and the inputs are a list.

Attributes:

  • id (str) –

    The identifier of the input, the QGIS parameter name.

  • title (str) –

    Human readable name.

  • description (str | None) –

    Human readable help text.

  • schema (Schema) –

    The schema of one value.

  • min_occurs (int) –

    The minimal number of values.

  • max_occurs (int | str) –

    The maximal number of values, unbounded for any.

Source code in src/qgis_server_light/interface/job/process/description.py
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
@dataclass(repr=False, kw_only=True)
class InputDescription(BaseInterface):
    """The description of one input of a process.

    OGC API - Processes holds the inputs as map by id. xsdata can't bind a map of
    dataclasses, therefore the id is part of the description and the inputs are a list.

    Attributes:
        id: The identifier of the input, the QGIS parameter name.
        title: Human readable name.
        description: Human readable help text.
        schema: The schema of one value.
        min_occurs: The minimal number of values.
        max_occurs: The maximal number of values, `unbounded` for any.
    """

    id: str = field(metadata={"type": "Element"})
    title: str = field(metadata={"type": "Element"})
    description: str | None = field(default=None, metadata={"type": "Element"})
    schema: Schema = field(metadata={"type": "Element"})
    min_occurs: int = field(default=1, metadata={"type": "Element", "name": "minOccurs"})
    max_occurs: int | str = field(default=1, metadata={"type": "Element", "name": "maxOccurs"})

    @property
    def shortened_fields(self) -> set:
        return {"description"}
description: str | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
id: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
max_occurs: int | str = field(default=1, metadata={'type': 'Element', 'name': 'maxOccurs'}) class-attribute instance-attribute
min_occurs: int = field(default=1, metadata={'type': 'Element', 'name': 'minOccurs'}) class-attribute instance-attribute
schema: Schema = field(metadata={'type': 'Element'}) class-attribute instance-attribute
shortened_fields: set property
title: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(*, id: str, title: str, description: str | None = None, schema: Schema, min_occurs: int = 1, max_occurs: int | str = 1) -> None
OutputDescription dataclass

Bases: BaseInterface

The description of one output of a process. The id is part of the description, see InputDescription.

Attributes:

  • id (str) –

    The identifier of the output, the QGIS output name.

  • title (str) –

    Human readable name.

  • schema (Schema) –

    The schema of the value.

Source code in src/qgis_server_light/interface/job/process/description.py
112
113
114
115
116
117
118
119
120
121
122
123
124
125
@dataclass(repr=False, kw_only=True)
class OutputDescription(BaseInterface):
    """The description of one output of a process. The id is part of the description,
    see `InputDescription`.

    Attributes:
        id: The identifier of the output, the QGIS output name.
        title: Human readable name.
        schema: The schema of the value.
    """

    id: str = field(metadata={"type": "Element"})
    title: str = field(metadata={"type": "Element"})
    schema: Schema = field(metadata={"type": "Element"})
id: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
schema: Schema = field(metadata={'type': 'Element'}) class-attribute instance-attribute
title: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(*, id: str, title: str, schema: Schema) -> None
ProcessDescription dataclass

Bases: BaseInterface

The description of one process.

Attributes:

  • id (str) –

    The identifier of the process, the QGIS algorithm id.

  • title (str) –

    Human readable name.

  • description (str | None) –

    Human readable help text.

  • inputs (list[InputDescription]) –

    The inputs which are passed by the client. Destinations are not part of it, they are set by the worker.

  • outputs (list[OutputDescription]) –

    The outputs the process produces.

  • internal (bool | None) –

    If the process is for internal use of the consumer only and must not be published. Left out (None) for a publishable process.

Source code in src/qgis_server_light/interface/job/process/description.py
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
@dataclass(repr=False, kw_only=True)
class ProcessDescription(BaseInterface):
    """The description of one process.

    Attributes:
        id: The identifier of the process, the QGIS algorithm id.
        title: Human readable name.
        description: Human readable help text.
        inputs: The inputs which are passed by the client. Destinations are not part of
            it, they are set by the worker.
        outputs: The outputs the process produces.
        internal: If the process is for internal use of the consumer only and must not be
            published. Left out (`None`) for a publishable process.
    """

    id: str = field(metadata={"type": "Element"})
    title: str = field(metadata={"type": "Element"})
    description: str | None = field(default=None, metadata={"type": "Element"})
    inputs: list[InputDescription] = field(default_factory=list, metadata={"type": "Element"})
    outputs: list[OutputDescription] = field(default_factory=list, metadata={"type": "Element"})
    internal: bool | None = field(default=None, metadata={"type": "Element"})

    @property
    def shortened_fields(self) -> set:
        return {"description"}
description: str | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
id: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
inputs: list[InputDescription] = field(default_factory=list, metadata={'type': 'Element'}) class-attribute instance-attribute
internal: bool | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
outputs: list[OutputDescription] = field(default_factory=list, metadata={'type': 'Element'}) class-attribute instance-attribute
shortened_fields: set property
title: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(*, id: str, title: str, description: str | None = None, inputs: list[InputDescription] = list(), outputs: list[OutputDescription] = list(), internal: bool | None = None) -> None
ProcessDescriptions dataclass

Bases: BaseInterface

The processes a process-worker serves (see RedisProtocol.worker_processes_key), or all process-workers together as the dispatcher merges them.

Attributes:

Source code in src/qgis_server_light/interface/job/process/description.py
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
@dataclass(repr=False)
class ProcessDescriptions(BaseInterface):
    """The processes a process-worker serves (see `RedisProtocol.worker_processes_key`),
    or all process-workers together as the dispatcher merges them.

    Attributes:
        processes: The description per process.
        warnings: The processes the workers don't agree on, only set by the dispatcher.
    """

    processes: list[ProcessDescription] = field(default_factory=list, metadata={"type": "Element"})
    warnings: list[ProcessWarning] = field(default_factory=list, metadata={"type": "Element"})

    def process_by_id(self, process_id: str) -> ProcessDescription:
        """
        Args:
            process_id: The identifier of the process.

        Raises:
            LookupError: If no process with this id is described.
        """
        for process in self.processes:
            if process.id == process_id:
                return process
        raise LookupError(f"Process `{process_id}` is not described")
processes: list[ProcessDescription] = field(default_factory=list, metadata={'type': 'Element'}) class-attribute instance-attribute
warnings: list[ProcessWarning] = field(default_factory=list, metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(processes: list[ProcessDescription] = list(), warnings: list[ProcessWarning] = list()) -> None
process_by_id(process_id: str) -> ProcessDescription

Parameters:

  • process_id (str) –

    The identifier of the process.

Raises:

  • LookupError –

    If no process with this id is described.

Source code in src/qgis_server_light/interface/job/process/description.py
187
188
189
190
191
192
193
194
195
196
197
198
def process_by_id(self, process_id: str) -> ProcessDescription:
    """
    Args:
        process_id: The identifier of the process.

    Raises:
        LookupError: If no process with this id is described.
    """
    for process in self.processes:
        if process.id == process_id:
            return process
    raise LookupError(f"Process `{process_id}` is not described")
ProcessWarning dataclass

Bases: BaseInterface

Tells that the process-workers serving a process don't agree on it. They run different QGIS versions or describe the process differently, so a job behaves differently depending on the worker which takes it. The deployment needs to be corrected then.

Attributes:

  • process_id (str) –

    The identifier of the process.

  • qgis_versions (list[str]) –

    The QGIS versions of the workers serving the process, the newest first.

  • descriptions_differ (bool) –

    If the workers describe the process differently.

Source code in src/qgis_server_light/interface/job/process/description.py
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
@dataclass(repr=False, kw_only=True)
class ProcessWarning(BaseInterface):
    """Tells that the process-workers serving a process don't agree on it. They run
    different QGIS versions or describe the process differently, so a job behaves
    differently depending on the worker which takes it. The deployment needs to be
    corrected then.

    Attributes:
        process_id: The identifier of the process.
        qgis_versions: The QGIS versions of the workers serving the process, the newest
            first.
        descriptions_differ: If the workers describe the process differently.
    """

    process_id: str = field(metadata={"type": "Element"})
    qgis_versions: list[str] = field(default_factory=list, metadata={"type": "Element"})
    descriptions_differ: bool = field(default=False, metadata={"type": "Element"})
descriptions_differ: bool = field(default=False, metadata={'type': 'Element'}) class-attribute instance-attribute
process_id: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
qgis_versions: list[str] = field(default_factory=list, metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(*, process_id: str, qgis_versions: list[str] = list(), descriptions_differ: bool = False) -> None
QslLayerKind

Bases: Enum

The kinds of layer QSL can load as value of a process input.

Source code in src/qgis_server_light/interface/job/process/description.py
20
21
22
23
24
class QslLayerKind(Enum):
    """The kinds of layer QSL can load as value of a process input."""

    VECTOR = "vector"
    RASTER = "raster"
RASTER = 'raster' class-attribute instance-attribute
VECTOR = 'vector' class-attribute instance-attribute
QslLayerMarker dataclass

Bases: BaseInterface

Marks a schema whose value is a layer (QslJobLayer) instead of a literal. A consumer replaces the marked schema with the layers it offers which match the marker.

Attributes:

  • kinds (list[QslLayerKind]) –

    The kinds of layer which are accepted.

  • geometry_types (list[str]) –

    The geometry types of a vector layer which are accepted, named as qgis.core.Qgis.GeometryType (Point, Line, Polygon, Null). Matches Vector.geometry_type_simple of the exported project. Applies to vector layers only, empty when no vector layer is accepted.

  • source (str | None) –

    The class name of the QGIS parameter or output the marker was derived from.

Source code in src/qgis_server_light/interface/job/process/description.py
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
@dataclass(repr=False)
class QslLayerMarker(BaseInterface):
    """Marks a schema whose value is a layer (`QslJobLayer`) instead of a literal. A
    consumer replaces the marked schema with the layers it offers which match the marker.

    Attributes:
        kinds: The kinds of layer which are accepted.
        geometry_types: The geometry types of a vector layer which are accepted, named as
            `qgis.core.Qgis.GeometryType` (`Point`, `Line`, `Polygon`, `Null`). Matches
            `Vector.geometry_type_simple` of the exported project. Applies to vector layers
            only, empty when no vector layer is accepted.
        source: The class name of the QGIS parameter or output the marker was derived from.
    """

    kinds: list[QslLayerKind] = field(metadata={"type": "Element"})
    geometry_types: list[str] = field(default_factory=list, metadata={"type": "Element"})
    source: str | None = field(default=None, metadata={"type": "Element"})
geometry_types: list[str] = field(default_factory=list, metadata={'type': 'Element'}) class-attribute instance-attribute
kinds: list[QslLayerKind] = field(metadata={'type': 'Element'}) class-attribute instance-attribute
source: str | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(kinds: list[QslLayerKind], geometry_types: list[str] = list(), source: str | None = None) -> None
Schema dataclass

Bases: BaseInterface

The subset of JSON Schema which is used to describe the values of inputs and outputs.

Attributes:

  • type (str | None) –

    The JSON Schema type (string, number, integer, boolean, ...).

  • format (str | None) –

    The format of the value. Layer values carry QSL_LAYER_FORMAT.

  • title (str | None) –

    Human readable name, used on the entries of one_of.

  • minimum (int | float | None) –

    The inclusive minimum of a numeric value.

  • maximum (int | float | None) –

    The inclusive maximum of a numeric value.

  • const (bool | int | float | str | None) –

    The only valid value, used on the entries of one_of.

  • default (bool | int | float | str | None) –

    The value used when none is passed.

  • one_of (list[Schema] | None) –

    The valid values, each as schema with const and title. For a file output the formats it is offered in, each as schema with content_media_type, the first one is the default.

  • content_media_type (str | None) –

    The media type of a value which is a file.

  • x_qsl_layer (QslLayerMarker | None) –

    The marker of a layer value.

Source code in src/qgis_server_light/interface/job/process/description.py
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
@dataclass(repr=False, kw_only=True)
class Schema(BaseInterface):
    """The subset of JSON Schema which is used to describe the values of inputs and
    outputs.

    Attributes:
        type: The JSON Schema type (`string`, `number`, `integer`, `boolean`, ...).
        format: The format of the value. Layer values carry `QSL_LAYER_FORMAT`.
        title: Human readable name, used on the entries of `one_of`.
        minimum: The inclusive minimum of a numeric value.
        maximum: The inclusive maximum of a numeric value.
        const: The only valid value, used on the entries of `one_of`.
        default: The value used when none is passed.
        one_of: The valid values, each as schema with `const` and `title`. For a file
            output the formats it is offered in, each as schema with
            `content_media_type`, the first one is the default.
        content_media_type: The media type of a value which is a file.
        x_qsl_layer: The marker of a layer value.
    """

    type: str | None = field(default=None, metadata={"type": "Element"})
    format: str | None = field(default=None, metadata={"type": "Element"})
    title: str | None = field(default=None, metadata={"type": "Element"})
    minimum: int | float | None = field(default=None, metadata={"type": "Element"})
    maximum: int | float | None = field(default=None, metadata={"type": "Element"})
    const: bool | int | float | str | None = field(default=None, metadata={"type": "Element"})
    default: bool | int | float | str | None = field(default=None, metadata={"type": "Element"})
    one_of: list["Schema"] | None = field(
        default=None, metadata={"type": "Element", "name": "oneOf"}
    )
    content_media_type: str | None = field(
        default=None, metadata={"type": "Element", "name": "contentMediaType"}
    )
    x_qsl_layer: QslLayerMarker | None = field(
        default=None, metadata={"type": "Element", "name": "x-qsl-layer"}
    )
const: bool | int | float | str | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
content_media_type: str | None = field(default=None, metadata={'type': 'Element', 'name': 'contentMediaType'}) class-attribute instance-attribute
default: bool | int | float | str | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
format: str | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
maximum: int | float | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
minimum: int | float | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
one_of: list[Schema] | None = field(default=None, metadata={'type': 'Element', 'name': 'oneOf'}) class-attribute instance-attribute
title: str | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
type: str | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
x_qsl_layer: QslLayerMarker | None = field(default=None, metadata={'type': 'Element', 'name': 'x-qsl-layer'}) class-attribute instance-attribute
__init__(*, type: str | None = None, format: str | None = None, title: str | None = None, minimum: int | float | None = None, maximum: int | float | None = None, const: bool | int | float | str | None = None, default: bool | int | float | str | None = None, one_of: list[Schema] | None = None, content_media_type: str | None = None, x_qsl_layer: QslLayerMarker | None = None) -> None

input

This module contains the execute request of a process job. It is shaped along the execute request of OGC API - Processes - Part 1: Core (https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/schemas/execute.yaml), carrying its inputs and outputs. OGC API - Processes holds them as maps by id, xsdata can't bind a map of dataclasses, therefore the id is part of each entry and they are lists (see InputDescription).

ExecuteInput dataclass

The value of one input of a process.

Attributes:

  • id (str) –

    The identifier of the input, the QGIS parameter name.

  • value (list[QslJobLayer | str | int | float | bool]) –

    The values of the input, one entry for an input taking a single value. A layer value is substituted in place by its QslJobLayer.

Source code in src/qgis_server_light/interface/job/process/input.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
@dataclass
class ExecuteInput:
    """The value of one input of a process.

    Attributes:
        id: The identifier of the input, the QGIS parameter name.
        value: The values of the input, one entry for an input taking a single value. A
            layer value is substituted in place by its `QslJobLayer`.
    """

    id: str = field(metadata={"type": "Element"})
    value: list[QslJobLayer | str | int | float | bool] = field(
        default_factory=list, metadata={"type": "Element"}
    )
id: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
value: list[QslJobLayer | str | int | float | bool] = field(default_factory=list, metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(id: str, value: list[QslJobLayer | str | int | float | bool] = list()) -> None
ExecuteOutput dataclass

The format a client wants a file output in.

Attributes:

  • id (str) –

    The identifier of the output, the QGIS output name.

  • format (Format) –

    The format the output is written in.

Source code in src/qgis_server_light/interface/job/process/input.py
45
46
47
48
49
50
51
52
53
54
55
@dataclass
class ExecuteOutput:
    """The format a client wants a file output in.

    Attributes:
        id: The identifier of the output, the QGIS output name.
        format: The format the output is written in.
    """

    id: str = field(metadata={"type": "Element"})
    format: Format = field(metadata={"type": "Element"})
format: Format = field(metadata={'type': 'Element'}) class-attribute instance-attribute
id: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(id: str, format: Format) -> None
Format dataclass

The format of a file output.

Attributes:

  • media_type (str) –

    One of the media types the description offers for the output.

Source code in src/qgis_server_light/interface/job/process/input.py
34
35
36
37
38
39
40
41
42
@dataclass
class Format:
    """The format of a file output.

    Attributes:
        media_type: One of the media types the description offers for the output.
    """

    media_type: str = field(metadata={"type": "Element", "name": "mediaType"})
media_type: str = field(metadata={'type': 'Element', 'name': 'mediaType'}) class-attribute instance-attribute
__init__(media_type: str) -> None
QslJobInfoExecuteProcess dataclass

Bases: QslJobInfoParameter

The job of a process execution, queued with RedisStateQueue.submit.

Source code in src/qgis_server_light/interface/job/process/input.py
74
75
76
77
78
@dataclass
class QslJobInfoExecuteProcess(QslJobInfoParameter):
    """The job of a process execution, queued with `RedisStateQueue.submit`."""

    job: QslJobParameterExecuteProcess = field(metadata={"type": "Element", "required": True})
job: QslJobParameterExecuteProcess = field(metadata={'type': 'Element', 'required': True}) class-attribute instance-attribute
__init__(id: str, type: str, job: QslJobParameterExecuteProcess, execution_mode: ExecutionMode = ExecutionMode.SYNC) -> None
QslJobParameterExecuteProcess dataclass

Bases: QslJobParameter

The execute request of a process.

Attributes:

  • process_id (str) –

    The identifier of the process, the QGIS algorithm id.

  • inputs (list[ExecuteInput]) –

    The values of the inputs, an input which is left out takes its default.

  • outputs (list[ExecuteOutput]) –

    The formats chosen for file outputs, an output which is left out is written in the first format its description offers.

Source code in src/qgis_server_light/interface/job/process/input.py
58
59
60
61
62
63
64
65
66
67
68
69
70
71
@dataclass(kw_only=True)
class QslJobParameterExecuteProcess(QslJobParameter):
    """The execute request of a process.

    Attributes:
        process_id: The identifier of the process, the QGIS algorithm id.
        inputs: The values of the inputs, an input which is left out takes its default.
        outputs: The formats chosen for file outputs, an output which is left out is
            written in the first format its description offers.
    """

    process_id: str = field(metadata={"type": "Element"})
    inputs: list[ExecuteInput] = field(default_factory=list, metadata={"type": "Element"})
    outputs: list[ExecuteOutput] = field(default_factory=list, metadata={"type": "Element"})
inputs: list[ExecuteInput] = field(default_factory=list, metadata={'type': 'Element'}) class-attribute instance-attribute
outputs: list[ExecuteOutput] = field(default_factory=list, metadata={'type': 'Element'}) class-attribute instance-attribute
process_id: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(*, process_id: str, inputs: list[ExecuteInput] = list(), outputs: list[ExecuteOutput] = list()) -> None

output

This module contains the result of a process job. It is shaped along the results of OGC API - Processes - Part 1: Core (https://schemas.opengis.net/ogcapi/processes/part1/1.0/openapi/schemas/results.yaml), per output either the literal value or a reference to the file. The outputs are a list of entries with their id instead of a map by id, see ExecuteInput.

ProcessResult dataclass

Bases: BaseInterface

The result of a process. A worker ships it as xsdata JSON in the data of the JobResult, so the dispatcher can parse it back without knowing anything about QGIS.

Attributes:

  • outputs (list[ResultOutput]) –

    The outputs of the process.

  • log (str) –

    The log the QGIS algorithm wrote while it was running. It has no place in the results of OGC API - Processes and travels next to the outputs.

Source code in src/qgis_server_light/interface/job/process/output.py
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
@dataclass(repr=False)
class ProcessResult(BaseInterface):
    """The result of a process. A worker ships it as xsdata JSON in the data of
    the `JobResult`, so the dispatcher can parse it back without knowing
    anything about QGIS.

    Attributes:
        outputs: The outputs of the process.
        log: The log the QGIS algorithm wrote while it was running. It has no place in
            the results of OGC API - Processes and travels next to the outputs.
    """

    outputs: list[ResultOutput] = field(default_factory=list, metadata={"type": "Element"})
    log: str = field(default="", metadata={"type": "Element"})

    @property
    def shortened_fields(self) -> set:
        return {"log"}
log: str = field(default='', metadata={'type': 'Element'}) class-attribute instance-attribute
outputs: list[ResultOutput] = field(default_factory=list, metadata={'type': 'Element'}) class-attribute instance-attribute
shortened_fields: set property
__init__(outputs: list[ResultOutput] = list(), log: str = '') -> None
Reference dataclass

A file a process wrote into the process output dir of the worker.

Attributes:

  • href (str) –

    The path of the file relative to the process output dir.

  • type (str) –

    The media type of the file.

Source code in src/qgis_server_light/interface/job/process/output.py
13
14
15
16
17
18
19
20
21
22
23
@dataclass
class Reference:
    """A file a process wrote into the process output dir of the worker.

    Attributes:
        href: The path of the file relative to the process output dir.
        type: The media type of the file.
    """

    href: str = field(metadata={"type": "Element"})
    type: str = field(metadata={"type": "Element"})
href: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
type: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(href: str, type: str) -> None
ResultOutput dataclass

A single output of a process, the counterpart of ExecuteInput.

Attributes:

  • id (str) –

    The identifier of the output, the QGIS output name.

  • value (Reference | str | int | float | bool) –

    The file the output was written to, or the literal value of the output.

Source code in src/qgis_server_light/interface/job/process/output.py
26
27
28
29
30
31
32
33
34
35
36
37
@dataclass
class ResultOutput:
    """A single output of a process, the counterpart of `ExecuteInput`.

    Attributes:
        id: The identifier of the output, the QGIS output name.
        value: The file the output was written to, or the literal value of the
            output.
    """

    id: str = field(metadata={"type": "Element"})
    value: Reference | str | int | float | bool = field(metadata={"type": "Element"})
id: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
value: Reference | str | int | float | bool = field(metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(id: str, value: Reference | str | int | float | bool) -> None

render

input

QslJobInfoRender dataclass

Bases: QslJobInfoParameter

Source code in src/qgis_server_light/interface/job/render/input.py
30
31
32
@dataclass
class QslJobInfoRender(QslJobInfoParameter):
    job: QslJobParameterRender = field(metadata={"type": "Element", "required": True})
job: QslJobParameterRender = field(metadata={'type': 'Element', 'required': True}) class-attribute instance-attribute
__init__(id: str, type: str, job: QslJobParameterRender, execution_mode: ExecutionMode = ExecutionMode.SYNC) -> None
QslJobParameterRender dataclass

Bases: QslJobParameter

A runner to be rendered as an image

Source code in src/qgis_server_light/interface/job/render/input.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
@dataclass(kw_only=True)
class QslJobParameterRender(QslJobParameter):
    """A runner to be rendered as an image"""

    layers: list[QslJobLayer] = field(metadata={"type": "Element"})
    bbox: BBox = field(metadata={"type": "Element"})
    crs: str = field(metadata={"type": "Element"})
    width: int = field(metadata={"type": "Element"})
    height: int = field(metadata={"type": "Element"})
    dpi: int | None = field(default=None, metadata={"type": "Element"})
    format: str = field(default="image/png", metadata={"type": "Element"})

    def get_layer_by_name(self, name: str) -> QslJobLayer:
        for layer in self.layers:
            if layer.name == name:
                return layer
        raise LookupError(f'No layer with name "{name}" was found."')
bbox: BBox = field(metadata={'type': 'Element'}) class-attribute instance-attribute
crs: str = field(metadata={'type': 'Element'}) class-attribute instance-attribute
dpi: int | None = field(default=None, metadata={'type': 'Element'}) class-attribute instance-attribute
format: str = field(default='image/png', metadata={'type': 'Element'}) class-attribute instance-attribute
height: int = field(metadata={'type': 'Element'}) class-attribute instance-attribute
layers: list[QslJobLayer] = field(metadata={'type': 'Element'}) class-attribute instance-attribute
width: int = field(metadata={'type': 'Element'}) class-attribute instance-attribute
__init__(*, layers: list[QslJobLayer], bbox: BBox, crs: str, width: int, height: int, dpi: int | None = None, format: str = 'image/png') -> None
get_layer_by_name(name: str) -> QslJobLayer
Source code in src/qgis_server_light/interface/job/render/input.py
23
24
25
26
27
def get_layer_by_name(self, name: str) -> QslJobLayer:
    for layer in self.layers:
        if layer.name == name:
            return layer
    raise LookupError(f'No layer with name "{name}" was found."')

output