QGIS API Documentation 3.41.0-Master (25ec5511245)
Loading...
Searching...
No Matches
Classes | Public Types | Static Public Member Functions | List of all members
QgsOgcUtils Class Reference

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

#include <qgsogcutils.h>

Classes

struct  Context
 The Context struct stores the current layer and coordinate transform context. More...
 
class  LayerProperties
 Layer properties. More...
 

Public Types

enum  FilterVersion { FILTER_OGC_1_0 , FILTER_OGC_1_1 , FILTER_FES_2_0 }
 OGC filter version. More...
 
enum  GMLVersion { GML_2_1_2 , GML_3_1_0 , GML_3_2_1 }
 GML version. More...
 

Static Public Member Functions

static QColor colorFromOgcFill (const QDomElement &fillElement)
 Parse XML with OGC fill into QColor.
 
static QDomElement elseFilterExpression (QDomDocument &doc)
 Creates an ElseFilter from doc.
 
static QgsExpressionexpressionFromOgcFilter (const QDomElement &element, FilterVersion version, QgsVectorLayer *layer=nullptr)
 Returns an expression from a WFS filter embedded in a document.
 
static QgsExpressionexpressionFromOgcFilter (const QDomElement &element, QgsVectorLayer *layer=nullptr)
 Parse XML with OGC filter into QGIS expression.
 
static QDomElement expressionToOgcExpression (const QgsExpression &exp, QDomDocument &doc, QgsOgcUtils::GMLVersion gmlVersion, FilterVersion filterVersion, const QString &geometryName, const QString &srsName, bool honourAxisOrientation, bool invertAxisOrientation, QString *errorMessage=nullptr, bool requiresFilterElement=false, const QMap< QString, QString > &fieldNameToXPathMap=QMap< QString, QString >(), const QMap< QString, QString > &namespacePrefixToUriMap=QMap< QString, QString >())
 Creates an OGC expression XML element from the exp expression.
 
static QDomElement expressionToOgcExpression (const QgsExpression &exp, QDomDocument &doc, QString *errorMessage=nullptr, bool requiresFilterElement=false)
 Creates an OGC expression XML element from the exp expression with default values for the geometry name, srs name, honourAsisOrientation and invertAxisOrientation.
 
static QDomElement expressionToOgcFilter (const QgsExpression &exp, QDomDocument &doc, QgsOgcUtils::GMLVersion gmlVersion, FilterVersion filterVersion, const QString &namespacePrefix, const QString &namespaceURI, const QString &geometryName, const QString &srsName, bool honourAxisOrientation, bool invertAxisOrientation, QString *errorMessage=nullptr, const QMap< QString, QString > &fieldNameToXPathMap=QMap< QString, QString >(), const QMap< QString, QString > &namespacePrefixToUriMap=QMap< QString, QString >())
 Creates OGC filter XML element.
 
static QDomElement expressionToOgcFilter (const QgsExpression &exp, QDomDocument &doc, QString *errorMessage=nullptr)
 Creates OGC filter XML element.
 
static QgsGeometry geometryFromGML (const QDomNode &geometryNode, const QgsOgcUtils::Context &context=QgsOgcUtils::Context())
 Static method that creates geometry from GML.
 
static QgsGeometry geometryFromGML (const QString &xmlString, const QgsOgcUtils::Context &context=QgsOgcUtils::Context())
 Static method that creates geometry from GML.
 
static QDomElement geometryToGML (const QgsGeometry &geometry, QDomDocument &doc, const QString &format, int precision=17)
 Exports the geometry to GML2 or GML3.
 
static QDomElement geometryToGML (const QgsGeometry &geometry, QDomDocument &doc, int precision=17)
 Exports the geometry to GML2.
 
static QDomElement geometryToGML (const QgsGeometry &geometry, QDomDocument &doc, QgsOgcUtils::GMLVersion gmlVersion, const QString &srsName, bool invertAxisOrientation, const QString &gmlIdBase, int precision=17)
 Exports the geometry to GML.
 
static QgsRectangle rectangleFromGMLBox (const QDomNode &boxNode)
 Read rectangle from GML2 Box.
 
static QgsRectangle rectangleFromGMLEnvelope (const QDomNode &envelopeNode)
 Read rectangle from GML3 Envelope.
 
static QDomElement rectangleToGMLBox (QgsRectangle *box, QDomDocument &doc, const QString &srsName, bool invertAxisOrientation, int precision=17)
 Exports the rectangle to GML2 Box.
 
static QDomElement rectangleToGMLBox (QgsRectangle *box, QDomDocument &doc, int precision=17)
 Exports the rectangle to GML2 Box.
 
static QDomElement rectangleToGMLEnvelope (QgsRectangle *env, QDomDocument &doc, const QString &srsName, bool invertAxisOrientation, int precision=17)
 Exports the rectangle to GML3 Envelope.
 
static QDomElement rectangleToGMLEnvelope (QgsRectangle *env, QDomDocument &doc, int precision=17)
 Exports the rectangle to GML3 Envelope.
 
static QDomElement SQLStatementToOgcFilter (const QgsSQLStatement &statement, QDomDocument &doc, QgsOgcUtils::GMLVersion gmlVersion, FilterVersion filterVersion, const QList< LayerProperties > &layerProperties, bool honourAxisOrientation, bool invertAxisOrientation, const QMap< QString, QString > &mapUnprefixedTypenameToPrefixedTypename, QString *errorMessage=nullptr, const QMap< QString, QString > &fieldNameToXPathMap=QMap< QString, QString >(), const QMap< QString, QString > &namespacePrefixToUriMap=QMap< QString, QString >())
 Creates OGC filter XML element from the WHERE and JOIN clauses of a SQL statement.
 

Detailed Description

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

Currently supported standards:

Definition at line 53 of file qgsogcutils.h.

Member Enumeration Documentation

◆ FilterVersion

OGC filter version.

Enumerator
FILTER_OGC_1_0 
FILTER_OGC_1_1 
FILTER_FES_2_0 

Definition at line 177 of file qgsogcutils.h.

◆ GMLVersion

GML version.

Enumerator
GML_2_1_2 
GML_3_1_0 
GML_3_2_1 

Definition at line 79 of file qgsogcutils.h.

Member Function Documentation

◆ colorFromOgcFill()

QColor QgsOgcUtils::colorFromOgcFill ( const QDomElement &  fillElement)
static

Parse XML with OGC fill into QColor.

Definition at line 1648 of file qgsogcutils.cpp.

◆ elseFilterExpression()

QDomElement QgsOgcUtils::elseFilterExpression ( QDomDocument &  doc)
static

Creates an ElseFilter from doc.

Returns
valid OGC ElseFilter QDomElement
Since
QGIS 3.28

Definition at line 1884 of file qgsogcutils.cpp.

◆ expressionFromOgcFilter() [1/2]

QgsExpression * QgsOgcUtils::expressionFromOgcFilter ( const QDomElement &  element,
FilterVersion  version,
QgsVectorLayer layer = nullptr 
)
static

Returns an expression from a WFS filter embedded in a document.

Parameters
elementThe WFS Filter
versionThe WFS version
layerLayer to use to retrieve field values from literal filters
Since
QGIS 3.4

Definition at line 1692 of file qgsogcutils.cpp.

◆ expressionFromOgcFilter() [2/2]

QgsExpression * QgsOgcUtils::expressionFromOgcFilter ( const QDomElement &  element,
QgsVectorLayer layer = nullptr 
)
static

Parse XML with OGC filter into QGIS expression.

Definition at line 1687 of file qgsogcutils.cpp.

◆ expressionToOgcExpression() [1/2]

QDomElement QgsOgcUtils::expressionToOgcExpression ( const QgsExpression exp,
QDomDocument &  doc,
QgsOgcUtils::GMLVersion  gmlVersion,
FilterVersion  filterVersion,
const QString &  geometryName,
const QString &  srsName,
bool  honourAxisOrientation,
bool  invertAxisOrientation,
QString *  errorMessage = nullptr,
bool  requiresFilterElement = false,
const QMap< QString, QString > &  fieldNameToXPathMap = QMap<QString, QString>(),
const QMap< QString, QString > &  namespacePrefixToUriMap = QMap<QString, QString>() 
)
static

Creates an OGC expression XML element from the exp expression.

Returns
valid OGC expression QDomElement on success or a valid
<Filter> 
QDomElement when requiresFilterElement is set. otherwise null QDomElement

Definition at line 1931 of file qgsogcutils.cpp.

◆ expressionToOgcExpression() [2/2]

QDomElement QgsOgcUtils::expressionToOgcExpression ( const QgsExpression exp,
QDomDocument &  doc,
QString *  errorMessage = nullptr,
bool  requiresFilterElement = false 
)
static

Creates an OGC expression XML element from the exp expression with default values for the geometry name, srs name, honourAsisOrientation and invertAxisOrientation.

Returns
valid OGC expression QDomElement on success or a valid
<Filter> 
QDomElement when requiresFilterElement is set. otherwise null QDomElement

Definition at line 1878 of file qgsogcutils.cpp.

◆ expressionToOgcFilter() [1/2]

QDomElement QgsOgcUtils::expressionToOgcFilter ( const QgsExpression exp,
QDomDocument &  doc,
QgsOgcUtils::GMLVersion  gmlVersion,
FilterVersion  filterVersion,
const QString &  namespacePrefix,
const QString &  namespaceURI,
const QString &  geometryName,
const QString &  srsName,
bool  honourAxisOrientation,
bool  invertAxisOrientation,
QString *  errorMessage = nullptr,
const QMap< QString, QString > &  fieldNameToXPathMap = QMap<QString, QString>(),
const QMap< QString, QString > &  namespacePrefixToUriMap = QMap<QString, QString>() 
)
static

Creates OGC filter XML element.

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

Returns
valid
<Filter> 
QDomElement on success, otherwise null QDomElement
Note
not available in Python bindings

Definition at line 1890 of file qgsogcutils.cpp.

◆ expressionToOgcFilter() [2/2]

QDomElement QgsOgcUtils::expressionToOgcFilter ( const QgsExpression exp,
QDomDocument &  doc,
QString *  errorMessage = nullptr 
)
static

Creates OGC filter XML element.

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

Returns
valid
<Filter> 
QDomElement on success, otherwise null QDomElement

Definition at line 1872 of file qgsogcutils.cpp.

◆ geometryFromGML() [1/2]

QgsGeometry QgsOgcUtils::geometryFromGML ( const QDomNode &  geometryNode,
const QgsOgcUtils::Context context = QgsOgcUtils::Context() 
)
static

Static method that creates geometry from GML.

Definition at line 87 of file qgsogcutils.cpp.

◆ geometryFromGML() [2/2]

QgsGeometry QgsOgcUtils::geometryFromGML ( const QString &  xmlString,
const QgsOgcUtils::Context context = QgsOgcUtils::Context() 
)
static

Static method that creates geometry from GML.

Parameters
xmlStringxml representation of the geometry. GML elements are expected to be in default namespace (
{<Point>...</Point> 
) or in "gml" namespace (
<gml:Point>...</gml:Point> 
)
contextQgsOgcUtils context

Definition at line 197 of file qgsogcutils.cpp.

◆ geometryToGML() [1/3]

QDomElement QgsOgcUtils::geometryToGML ( const QgsGeometry geometry,
QDomDocument &  doc,
const QString &  format,
int  precision = 17 
)
static

Exports the geometry to GML2 or GML3.

Returns
QDomElement

Definition at line 1209 of file qgsogcutils.cpp.

◆ geometryToGML() [2/3]

QDomElement QgsOgcUtils::geometryToGML ( const QgsGeometry geometry,
QDomDocument &  doc,
int  precision = 17 
)
static

Exports the geometry to GML2.

Returns
QDomElement

Definition at line 1590 of file qgsogcutils.cpp.

◆ geometryToGML() [3/3]

QDomElement QgsOgcUtils::geometryToGML ( const QgsGeometry geometry,
QDomDocument &  doc,
QgsOgcUtils::GMLVersion  gmlVersion,
const QString &  srsName,
bool  invertAxisOrientation,
const QString &  gmlIdBase,
int  precision = 17 
)
static

Exports the geometry to GML.

Returns
QDomElement

Definition at line 1214 of file qgsogcutils.cpp.

◆ rectangleFromGMLBox()

QgsRectangle QgsOgcUtils::rectangleFromGMLBox ( const QDomNode &  boxNode)
static

Read rectangle from GML2 Box.

Definition at line 968 of file qgsogcutils.cpp.

◆ rectangleFromGMLEnvelope()

QgsRectangle QgsOgcUtils::rectangleFromGMLEnvelope ( const QDomNode &  envelopeNode)
static

Read rectangle from GML3 Envelope.

Definition at line 1049 of file qgsogcutils.cpp.

◆ rectangleToGMLBox() [1/2]

QDomElement QgsOgcUtils::rectangleToGMLBox ( QgsRectangle box,
QDomDocument &  doc,
const QString &  srsName,
bool  invertAxisOrientation,
int  precision = 17 
)
static

Exports the rectangle to GML2 Box.

Returns
QDomElement

Definition at line 1133 of file qgsogcutils.cpp.

◆ rectangleToGMLBox() [2/2]

QDomElement QgsOgcUtils::rectangleToGMLBox ( QgsRectangle box,
QDomDocument &  doc,
int  precision = 17 
)
static

Exports the rectangle to GML2 Box.

Returns
QDomElement

Definition at line 1128 of file qgsogcutils.cpp.

◆ rectangleToGMLEnvelope() [1/2]

QDomElement QgsOgcUtils::rectangleToGMLEnvelope ( QgsRectangle env,
QDomDocument &  doc,
const QString &  srsName,
bool  invertAxisOrientation,
int  precision = 17 
)
static

Exports the rectangle to GML3 Envelope.

Returns
QDomElement

Definition at line 1173 of file qgsogcutils.cpp.

◆ rectangleToGMLEnvelope() [2/2]

QDomElement QgsOgcUtils::rectangleToGMLEnvelope ( QgsRectangle env,
QDomDocument &  doc,
int  precision = 17 
)
static

Exports the rectangle to GML3 Envelope.

Returns
QDomElement

Definition at line 1168 of file qgsogcutils.cpp.

◆ SQLStatementToOgcFilter()

QDomElement QgsOgcUtils::SQLStatementToOgcFilter ( const QgsSQLStatement statement,
QDomDocument &  doc,
QgsOgcUtils::GMLVersion  gmlVersion,
FilterVersion  filterVersion,
const QList< LayerProperties > &  layerProperties,
bool  honourAxisOrientation,
bool  invertAxisOrientation,
const QMap< QString, QString > &  mapUnprefixedTypenameToPrefixedTypename,
QString *  errorMessage = nullptr,
const QMap< QString, QString > &  fieldNameToXPathMap = QMap<QString, QString>(),
const QMap< QString, QString > &  namespacePrefixToUriMap = QMap<QString, QString>() 
)
static

Creates OGC filter XML element from the WHERE and JOIN clauses of a SQL statement.

Supports minimum standard filter according to the OGC filter specs (=,!=,<,>,<=,>=,AND,OR,NOT,LIKE,BETWEEN,IN) Supports layer joins. Supports ST_GeometryFromText(wkt[, srid/srsname]), ST_MakeEnvelope(xmin,ymin,xmax,ymax[, srid/srsname]) ST_GeomFromGML(serialized_gml_string) BBOX() ST_Intersects(), ST_Contains(), ST_Crosses(), ST_Equals(), ST_Disjoint(), ST_Overlaps(), ST_Touches(), ST_Within() ST_DWithin(), ST_Beyond() custom functions

Returns
valid
<Filter> 
QDomElement on success, otherwise null QDomElement
Note
not available in Python bindings

Definition at line 1989 of file qgsogcutils.cpp.


The documentation for this class was generated from the following files: