QgsGmlStreamingParser class

This class builds features from GML data in a streaming way.

The caller must call processData() as soon it has new content from the source. At any point, it can call getAndStealReadyFeatures() to collect the features that have been completely parsed.

Public types

class LayerProperties
Layer properties.
enum AxisOrientationLogic { Honour_EPSG_if_urn, Honour_EPSG, Ignore_EPSG }
Axis orientation logic.

Constructors, destructors, conversion operators

QgsGmlStreamingParser(const QString& typeName, const QString& geometryAttribute, const QgsFields& fields, AxisOrientationLogic axisOrientationLogic = Honour_EPSG_if_urn, bool invertAxisOrientation = false)
Constructor.
QgsGmlStreamingParser(const QList<LayerProperties>& layerProperties, const QgsFields& fields, const QMap<QString, QPair<QString, QString>>& mapFieldNameToSrcLayerNameFieldName, AxisOrientationLogic axisOrientationLogic = Honour_EPSG_if_urn, bool invertAxisOrientation = false)
Constructor for a join layer, or dealing with renamed fields.
QgsGmlStreamingParser(const QgsGmlStreamingParser& other) deleted
QgsGmlStreamingParser cannot be copied.

Public functions

auto exceptionText() const -> QString
Returns the exception text.
auto getAndStealReadyFeatures() -> QVector<QgsGmlFeaturePtrGmlIdPair>
Returns the list of features that have been completely parsed.
auto getEPSGCode() const -> int
Returns the EPSG code, or 0 if unknown.
auto isException() const -> bool
Returns whether the document parser is a OGC exception.
auto isTruncatedResponse() const -> bool
Returns whether a "truncatedResponse" element is found.
auto layerExtent() const -> const QgsRectangle&
Returns layer bounding box.
auto numberMatched() const -> int
Returns WFS 2.0 "numberMatched" attribute, or -1 if invalid/not found.
auto numberReturned() const -> int
Returns WFS 2.0 "numberReturned" or WFS 1.1 "numberOfFeatures" attribute, or -1 if invalid/not found.
auto operator=(const QgsGmlStreamingParser& other) -> QgsGmlStreamingParser& deleted
QgsGmlStreamingParser cannot be copied.
auto processData(const QByteArray& data, bool atEnd, QString& errorMsg) -> bool
Process a new chunk of data.
auto processData(const QByteArray& data, bool atEnd) -> bool
Process a new chunk of data.
auto srsName() const -> QString
Returns the value of the srsName attribute.
auto wkbType() const -> QgsWkbTypes::Type
Returns the geometry type.

Enum documentation

enum QgsGmlStreamingParser::AxisOrientationLogic

Axis orientation logic.

Enumerators
Honour_EPSG_if_urn

Honour EPSG axis order only if srsName is of the form urn:ogc:def:crs:EPSG: *.

Honour_EPSG

Honour EPSG axis order.

Ignore_EPSG

Ignore EPSG axis order.

Function documentation

QVector<QgsGmlFeaturePtrGmlIdPair> QgsGmlStreamingParser::getAndStealReadyFeatures()

Returns the list of features that have been completely parsed.

This can be called at any point. This will empty the list maintained internally by the parser, so that features already returned will no longer be returned by later calls.

bool QgsGmlStreamingParser::processData(const QByteArray& data, bool atEnd, QString& errorMsg)

Process a new chunk of data.

atEnd must be set to true when this is the last chunk of data.

bool QgsGmlStreamingParser::processData(const QByteArray& data, bool atEnd)

Process a new chunk of data.

atEnd must be set to true when this is the last chunk of data.