Subgroup: other

Class: QgsOgcUtils

class qgis.core.QgsOgcUtils

Bases: sip.wrapper

The QgsOgcUtils class provides various utility functions for conversion between OGC (Open Geospatial Consortium) standards and QGIS internal representations.

Currently supported standards: - GML2 - Geography Markup Language (import, export)

Methods

colorFromOgcFill Parse XML with OGC fill into QColor
expressionFromOgcFilter Parse XML with OGC filter into QGIS expression
expressionToOgcExpression Creates an OGC expression XML element.
expressionToOgcFilter Creates OGC filter XML element.
geometryFromGML Static method that creates geometry from GML
geometryToGML Exports the geometry to GML
rectangleFromGMLBox Read rectangle from GML2 Box
rectangleFromGMLEnvelope Read rectangle from GML3 Envelope
rectangleToGMLBox Exports the rectangle to GML2 Box
rectangleToGMLEnvelope Exports the rectangle to GML3 Envelope

Signals

Attributes

FILTER_FES_2_0
FILTER_OGC_1_0
FILTER_OGC_1_1
GML_2_1_2
GML_3_1_0
GML_3_2_1
FILTER_FES_2_0 = 2
FILTER_OGC_1_0 = 0
FILTER_OGC_1_1 = 1
class FilterVersion

Bases: int

class GMLVersion

Bases: int

GML_2_1_2 = 0
GML_3_1_0 = 1
GML_3_2_1 = 2
colorFromOgcFill(fillElement: QDomElement) → QColor

Parse XML with OGC fill into QColor

expressionFromOgcFilter(element: QDomElement, layer: QgsVectorLayer = None) → QgsExpression

Parse XML with OGC filter into QGIS expression

expressionFromOgcFilter(element: QDomElement, version: QgsOgcUtils.FilterVersion, layer: QgsVectorLayer = None) -> QgsExpression Returns an expression from a WFS filter embedded in a document.

Parameters:
  • element – The WFS Filter
  • version – The WFS version
  • layer – Layer to use to retrieve field values from literal filters

New in version 3.4.

expressionToOgcExpression(exp: QgsExpression, doc: QDomDocument, errorMessage: str = '') → QDomElement

Creates an OGC expression XML element.

Returns:valid OGC expression QDomElement on success, otherwise null QDomElement

expressionToOgcExpression(exp: QgsExpression, doc: QDomDocument, gmlVersion: QgsOgcUtils.GMLVersion, filterVersion: QgsOgcUtils.FilterVersion, geometryName: str, srsName: str, honourAxisOrientation: bool, invertAxisOrientation: bool, errorMessage: str = ‘’) -> QDomElement Creates an OGC expression XML element.

Returns:valid OGC expression QDomElement on success, otherwise null QDomElement
expressionToOgcFilter(exp: QgsExpression, doc: QDomDocument, errorMessage: str = '') → QDomElement

Creates OGC filter XML element. Supports minimum standard filter according to the OGC filter specs (=,!=,<,>,<=,>=,AND,OR,NOT)

Returns:valid verbatim <Filter> endverbatim QDomElement on success, otherwise null QDomElement
geometryFromGML(xmlString: str) → QgsGeometry

Static method that creates geometry from GML

Parameters:xmlString – xml representation of the geometry. GML elements are expected to be in default namespace (verbatim {<Point>…</Point> endverbatim) or in “gml” namespace (verbatim <gml:Point>…</gml:Point> endverbatim)

geometryFromGML(geometryNode: QDomNode) -> QgsGeometry Static method that creates geometry from GML

geometryToGML(geometry: QgsGeometry, doc: QDomDocument, gmlVersion: QgsOgcUtils.GMLVersion, srsName: str, invertAxisOrientation: bool, gmlIdBase: str, precision: int = 17) → QDomElement

Exports the geometry to GML

Returns:QDomElement

New in version 2.16.

geometryToGML(geometry: QgsGeometry, doc: QDomDocument, format: str, precision: int = 17) -> QDomElement Exports the geometry to GML2 or GML3

Returns:QDomElement

geometryToGML(geometry: QgsGeometry, doc: QDomDocument, precision: int = 17) -> QDomElement Exports the geometry to GML2

Returns:QDomElement
rectangleFromGMLBox(boxNode: QDomNode) → QgsRectangle

Read rectangle from GML2 Box

rectangleFromGMLEnvelope(envelopeNode: QDomNode) → QgsRectangle

Read rectangle from GML3 Envelope

rectangleToGMLBox(box: QgsRectangle, doc: QDomDocument, precision: int = 17) → QDomElement

Exports the rectangle to GML2 Box

Returns:QDomElement

rectangleToGMLBox(box: QgsRectangle, doc: QDomDocument, srsName: str, invertAxisOrientation: bool, precision: int = 17) -> QDomElement Exports the rectangle to GML2 Box

Returns:QDomElement

New in version 2.16.

rectangleToGMLEnvelope(env: QgsRectangle, doc: QDomDocument, precision: int = 17) → QDomElement

Exports the rectangle to GML3 Envelope

Returns:QDomElement

rectangleToGMLEnvelope(env: QgsRectangle, doc: QDomDocument, srsName: str, invertAxisOrientation: bool, precision: int = 17) -> QDomElement Exports the rectangle to GML3 Envelope

Returns:QDomElement

New in version 2.16.