QgsGml class

This class reads data from a WFS server or alternatively from a GML file.

Contents

It uses the expat XML parser and an event based model to keep performance high. The parsing starts when the first data arrives, it does not wait until the request is finished

Public functions

auto crs() const -> QgsCoordinateReferenceSystem
Returns features spatial reference system.
auto featuresMap() const -> QMap<QgsFeatureId, QgsFeature*>
Gets parsed features for given type name.
auto getFeatures(const QString& uri, QgsWkbTypes::Type* wkbType, QgsRectangle* extent = nullptr, const QString& userName = QString(), const QString& password = QString(), const QString& authcfg = QString()) -> int
Does the Http GET request to the wfs server Supports only UTF-8, UTF-16, ISO-8859-1, ISO-8859-1 XML encodings.
auto getFeatures(const QByteArray& data, QgsWkbTypes::Type* wkbType, QgsRectangle* extent = nullptr) -> int
Read from GML data.
auto idsMap() const -> QMap<QgsFeatureId, QString>
Gets feature ids map.

Signals

void dataProgressAndSteps(int progress, int totalSteps)
Also emit signal with progress and totalSteps together (this is better for the status message)

Function documentation

QgsCoordinateReferenceSystem QgsGml::crs() const

Returns features spatial reference system.

int QgsGml::getFeatures(const QString& uri, QgsWkbTypes::Type* wkbType, QgsRectangle* extent = nullptr, const QString& userName = QString(), const QString& password = QString(), const QString& authcfg = QString())

Does the Http GET request to the wfs server Supports only UTF-8, UTF-16, ISO-8859-1, ISO-8859-1 XML encodings.

Parameters
uri GML URL
wkbType wkbType to retrieve
extent retrieved extents
userName username for authentication
password password for authentication
authcfg authentication configuration id
Returns 0 in case of success

int QgsGml::getFeatures(const QByteArray& data, QgsWkbTypes::Type* wkbType, QgsRectangle* extent = nullptr)

Read from GML data.

Constructor uri param is ignored Supports only UTF-8, UTF-16, ISO-8859-1, ISO-8859-1 XML encodings.