27 #include "nlohmann/json.hpp" 33 const auto parts { bbox.split(
',', QString::SplitBehavior::SkipEmptyParts ) };
36 if ( parts.count() == 4 || parts.count() == 6 )
38 const auto hasZ { parts.count() == 6 };
39 auto toDouble = [ & ](
const int i ) ->
double 43 return parts[i].toDouble( &ok );
49 toDouble( 3 ), toDouble( 4 ) );
54 toDouble( 2 ), toDouble( 3 ) );
66 auto extent { layer->
extent() };
73 return {{ extent.xMinimum(), extent.yMinimum(), extent.xMaximum(), extent.yMaximum() }};
83 const auto parts { QUrl( bboxCrs ).path().split(
'/' ) };
84 if ( parts.count() == 6 )
86 return crs.
fromOgcWmsCrs( QStringLiteral(
"urn:ogc:def:crs:%1:%2:%3" ).arg( parts[3], parts[4], parts[5] ) );
100 QVector<QgsMapLayer *> result;
101 const auto constLayers { project->
mapLayers() };
102 for (
auto it = project->
mapLayers().constBegin(); it != project->
mapLayers().constEnd(); it++ )
104 if ( wfstUpdateLayersId.contains( it.value()->id() ) ||
105 wfstInsertLayersId.contains( it.value()->id() ) ||
106 wfstDeleteLayersId.contains( it.value()->id() ) )
108 result.push_back( it.value() );
117 QString result { QUrl( value ).toString() };
118 static const QRegularExpression re( R
"raw(;.*(DROP|DELETE|INSERT|UPDATE|CREATE|INTO))raw" ); 119 if ( re.match( result.toUpper() ).hasMatch() )
123 return result.replace(
'\'', QStringLiteral(
"\'" ) );
129 QStringList result { { QStringLiteral(
"http://www.opengis.net/def/crs/OGC/1.3/CRS84" )}};
133 for (
const QString &crsId : outputCrsList )
136 if ( ! crsUri.isEmpty() )
138 result.push_back( crsUri );
147 const auto parts { crs.
authid().split(
':' ) };
148 if ( parts.length() == 2 )
150 if ( parts[0] == QStringLiteral(
"EPSG" ) )
151 return QStringLiteral(
"http://www.opengis.net/def/crs/EPSG/9.6.2/%1" ).arg( parts[1] ) ;
152 else if ( parts[0] == QStringLiteral(
"OGC" ) )
154 return QStringLiteral(
"http://www.opengis.net/def/crs/OGC/1.3/%1" ).arg( parts[1] ) ;
170 QList<QPair<QString, QString> > qi;
171 QString result { path };
172 const auto constItems { requestUrl.queryItems( ) };
173 for (
const auto &i : constItems )
175 if ( i.first.compare( QStringLiteral(
"MAP" ), Qt::CaseSensitivity::CaseInsensitive ) == 0 )
182 if ( ! path.endsWith(
'?' ) )
186 result.append( QStringLiteral(
"MAP=%1" ).arg( qi.first().second ) );
SERVER_EXPORT QStringList wmsOutputCrsList(const QgsProject &project)
Returns the WMS output CRS list.
A rectangle specified with double values.
SERVER_EXPORT QStringList wfstUpdateLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published as WFS-T with update capabilities...
static QString sanitizedFieldValue(const QString &value)
Sanitizes the input value by removing URL encoding and checking for malicious content.
static QStringList publishedCrsList(const QgsProject *project)
Returns the list of CRSs (format: http://www.opengis.net/def/crs/OGC/1.3/CRS84) available for this pr...
const QgsCoordinateReferenceSystem & crs
static QgsCoordinateReferenceSystem parseCrs(const QString &bboxCrs)
Parses the CRS URI bboxCrs (example: "http://www.opengis.net/def/crs/OGC/1.3/CRS84") into a QGIS CRS ...
SERVER_EXPORT QStringList wfstDeleteLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published as WFS-T with delete capabilities...
long postgisSrid() const
Returns PostGIS SRID for the CRS.
static json layerExtent(const QgsVectorLayer *layer)
layerExtent returns json array with [xMin,yMin,xMax,yMax] CRS84 extent for the given layer FIXME: the...
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
static const QVector< QgsMapLayer * > publishedWfsLayers(const QgsProject *project)
Returns the list of layers accessible to the service for a given project.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts, annotations, canvases, etc.
static QString appendMapParameter(const QString &path, const QUrl &requestUrl)
Appends MAP query string parameter from current requestUrl to the given path.
QgsCoordinateTransformContext transformContext() const
Returns the layer data provider coordinate transform context or a default transform context if the la...
QMap< QString, QgsMapLayer * > mapLayers(const bool validOnly=false) const
Returns a map of all registered layers by layer ID.
QgsRectangle extent() const FINAL
Returns the extent of the layer.
static QString crsToOgcUri(const QgsCoordinateReferenceSystem &crs)
Returns a crs as OGC URI (format: http://www.opengis.net/def/crs/OGC/1.3/CRS84) Returns an empty stri...
static QgsCoordinateReferenceSystem fromOgcWmsCrs(const QString &ogcCrs)
Creates a CRS from a given OGC WMS-format Coordinate Reference System string.
SERVER_EXPORT QStringList wfsLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published in WFS.
This class represents a coordinate reference system (CRS).
static QgsRectangle parseBbox(const QString &bbox)
Parses a comma separated bbox into a (possibily empty) QgsRectangle.
SERVER_EXPORT QStringList wfstInsertLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published as WFS-T with insert capabilities...
Represents a vector layer which manages a vector based data sets.
QString authid() const
Returns the authority identifier for the CRS.
QgsCoordinateReferenceSystem crs