32 return QStringLiteral(
"1.0.0" );
37 QDomElement layerElem;
39 layerElem = doc.createElement( QStringLiteral(
"CoverageOfferingBrief" ) );
41 layerElem = doc.createElement( QStringLiteral(
"CoverageOffering" ) );
44 QDomElement nameElem = doc.createElement( QStringLiteral(
"name" ) );
45 QString name = layer->
name();
48 name = name.replace(
' ',
'_' );
49 const QDomText nameText = doc.createTextNode( name );
50 nameElem.appendChild( nameText );
51 layerElem.appendChild( nameElem );
54 QDomElement labelElem = doc.createElement( QStringLiteral(
"label" ) );
55 QString title = layer->
title();
56 if ( title.isEmpty() )
58 title = layer->
name();
60 const QDomText labelText = doc.createTextNode( title );
61 labelElem.appendChild( labelText );
62 layerElem.appendChild( labelElem );
65 const QString abstract = layer->
abstract();
66 if ( !abstract.isEmpty() )
68 QDomElement descriptionElem = doc.createElement( QStringLiteral(
"description" ) );
69 const QDomText descriptionText = doc.createTextNode( abstract );
70 descriptionElem.appendChild( descriptionText );
71 layerElem.appendChild( descriptionElem );
77 const int wgs84precision = 6;
87 QgsDebugError( QStringLiteral(
"Transform error caught: %1. Using original layer extent." ).arg( e.
what() ) );
90 QDomElement lonLatElem = doc.createElement( QStringLiteral(
"lonLatEnvelope" ) );
91 lonLatElem.setAttribute( QStringLiteral(
"srsName" ), QStringLiteral(
"urn:ogc:def:crs:OGC:1.3:CRS84" ) );
92 QDomElement lowerPosElem = doc.createElement( QStringLiteral(
"gml:pos" ) );
94 lowerPosElem.appendChild( lowerPosText );
95 lonLatElem.appendChild( lowerPosElem );
96 QDomElement upperPosElem = doc.createElement( QStringLiteral(
"gml:pos" ) );
98 upperPosElem.appendChild( upperPosText );
99 lonLatElem.appendChild( upperPosElem );
100 layerElem.appendChild( lonLatElem );
108 QDomElement domainSetElem = doc.createElement( QStringLiteral(
"domainSet" ) );
109 layerElem.appendChild( domainSetElem );
111 QDomElement spatialDomainElem = doc.createElement( QStringLiteral(
"spatialDomain" ) );
112 domainSetElem.appendChild( spatialDomainElem );
122 QDomElement envelopeElem = doc.createElement( QStringLiteral(
"gml:Envelope" ) );
123 envelopeElem.setAttribute( QStringLiteral(
"srsName" ), layerCrs.
authid() );
124 QDomElement lowerCornerElem = doc.createElement( QStringLiteral(
"gml:pos" ) );
126 lowerCornerElem.appendChild( lowerCornerText );
127 envelopeElem.appendChild( lowerCornerElem );
128 QDomElement upperCornerElem = doc.createElement( QStringLiteral(
"gml:pos" ) );
130 upperCornerElem.appendChild( upperCornerText );
131 envelopeElem.appendChild( upperCornerElem );
132 spatialDomainElem.appendChild( envelopeElem );
134 QDomElement rectGridElem = doc.createElement( QStringLiteral(
"gml:RectifiedGrid" ) );
135 rectGridElem.setAttribute( QStringLiteral(
"dimension" ), 2 );
136 QDomElement limitsElem = doc.createElement( QStringLiteral(
"gml:limits" ) );
137 rectGridElem.appendChild( limitsElem );
138 QDomElement gridEnvElem = doc.createElement( QStringLiteral(
"gml:GridEnvelope" ) );
139 limitsElem.appendChild( gridEnvElem );
140 QDomElement lowElem = doc.createElement( QStringLiteral(
"gml:low" ) );
141 const QDomText lowText = doc.createTextNode( QStringLiteral(
"0 0" ) );
142 lowElem.appendChild( lowText );
143 gridEnvElem.appendChild( lowElem );
144 QDomElement highElem = doc.createElement( QStringLiteral(
"gml:high" ) );
145 const QDomText highText = doc.createTextNode( QString::number( layer->
width() ) +
" " + QString::number( layer->
height() ) );
146 highElem.appendChild( highText );
147 gridEnvElem.appendChild( highElem );
148 spatialDomainElem.appendChild( rectGridElem );
150 QDomElement xAxisElem = doc.createElement( QStringLiteral(
"gml:axisName" ) );
151 const QDomText xAxisText = doc.createTextNode( QStringLiteral(
"x" ) );
152 xAxisElem.appendChild( xAxisText );
153 rectGridElem.appendChild( xAxisElem );
155 QDomElement yAxisElem = doc.createElement( QStringLiteral(
"gml:axisName" ) );
156 const QDomText yAxisText = doc.createTextNode( QStringLiteral(
"y" ) );
157 yAxisElem.appendChild( yAxisText );
158 rectGridElem.appendChild( yAxisElem );
160 QDomElement originElem = doc.createElement( QStringLiteral(
"gml:origin" ) );
161 QDomElement originPosElem = doc.createElement( QStringLiteral(
"gml:pos" ) );
162 originElem.appendChild( originPosElem );
164 originPosElem.appendChild( originPosText );
165 rectGridElem.appendChild( originElem );
167 QDomElement xOffsetElem = doc.createElement( QStringLiteral(
"gml:offsetVector" ) );
168 const QDomText xOffsetText = doc.createTextNode( QString::number( layer->
rasterUnitsPerPixelX() ) +
" 0" );
169 xOffsetElem.appendChild( xOffsetText );
170 rectGridElem.appendChild( xOffsetElem );
172 QDomElement yOffsetElem = doc.createElement( QStringLiteral(
"gml:offsetVector" ) );
173 const QDomText yOffsetText = doc.createTextNode(
"0 " + QString::number( layer->
rasterUnitsPerPixelY() ) );
174 yOffsetElem.appendChild( yOffsetText );
175 rectGridElem.appendChild( yOffsetElem );
178 QDomElement rangeSetElem = doc.createElement( QStringLiteral(
"rangeSet" ) );
179 layerElem.appendChild( rangeSetElem );
188 QDomElement RangeSetElem = doc.createElement( QStringLiteral(
"RangeSet" ) );
189 rangeSetElem.appendChild( RangeSetElem );
191 QDomElement rsNameElem = doc.createElement( QStringLiteral(
"name" ) );
192 const QDomText rsNameText = doc.createTextNode( QStringLiteral(
"Bands" ) );
193 rsNameElem.appendChild( rsNameText );
194 RangeSetElem.appendChild( rsNameElem );
196 QDomElement rsLabelElem = doc.createElement( QStringLiteral(
"label" ) );
197 const QDomText rsLabelText = doc.createTextNode( QStringLiteral(
"Bands" ) );
198 rsLabelElem.appendChild( rsLabelText );
199 RangeSetElem.appendChild( rsLabelElem );
201 QDomElement axisDescElem = doc.createElement( QStringLiteral(
"axisDescription" ) );
202 RangeSetElem.appendChild( axisDescElem );
204 QDomElement AxisDescElem = doc.createElement( QStringLiteral(
"AxisDescription" ) );
205 axisDescElem.appendChild( AxisDescElem );
207 QDomElement adNameElem = doc.createElement( QStringLiteral(
"name" ) );
208 const QDomText adNameText = doc.createTextNode( QStringLiteral(
"bands" ) );
209 adNameElem.appendChild( adNameText );
210 AxisDescElem.appendChild( adNameElem );
212 QDomElement adLabelElem = doc.createElement( QStringLiteral(
"label" ) );
213 const QDomText adLablelText = doc.createTextNode( QStringLiteral(
"bands" ) );
214 adLabelElem.appendChild( adLablelText );
215 AxisDescElem.appendChild( adLabelElem );
217 QDomElement adValuesElem = doc.createElement( QStringLiteral(
"values" ) );
218 for (
int idx = 0; idx < layer->
bandCount(); ++idx )
220 QDomElement adValueElem = doc.createElement( QStringLiteral(
"singleValue" ) );
221 const QDomText adValueText = doc.createTextNode( QString::number( idx + 1 ) );
222 adValueElem.appendChild( adValueText );
223 adValuesElem.appendChild( adValueElem );
225 AxisDescElem.appendChild( adValuesElem );
229 QDomElement sCRSElem = doc.createElement( QStringLiteral(
"supportedCRSs" ) );
230 QDomElement rCRSElem = doc.createElement( QStringLiteral(
"requestResponseCRSs" ) );
231 const QDomText rCRSText = doc.createTextNode( layerCrs.
authid() );
232 rCRSElem.appendChild( rCRSText );
233 sCRSElem.appendChild( rCRSElem );
234 QDomElement nCRSElem = doc.createElement( QStringLiteral(
"nativeCRSs" ) );
235 const QDomText nCRSText = doc.createTextNode( layerCrs.
authid() );
236 nCRSElem.appendChild( nCRSText );
237 sCRSElem.appendChild( nCRSElem );
238 layerElem.appendChild( sCRSElem );
242 QDomElement sFormatsElem = doc.createElement( QStringLiteral(
"supportedFormats" ) );
243 sFormatsElem.setAttribute( QStringLiteral(
"nativeFormat" ), QStringLiteral(
"raw binary" ) );
244 QDomElement formatsElem = doc.createElement( QStringLiteral(
"formats" ) );
245 const QDomText formatsText = doc.createTextNode( QStringLiteral(
"GeoTIFF" ) );
246 formatsElem.appendChild( formatsText );
247 sFormatsElem.appendChild( formatsElem );
248 layerElem.appendChild( sFormatsElem );
256 static const QSet< QString > sFilter
258 QStringLiteral(
"REQUEST" ),
259 QStringLiteral(
"VERSION" ),
260 QStringLiteral(
"SERVICE" ),
261 QStringLiteral(
"_DC" )
267 if ( href.isEmpty() )
272 const QList<QPair<QString, QString> > queryItems = q.queryItems();
273 for (
const QPair<QString, QString> ¶m : queryItems )
275 if ( sFilter.contains( param.first.toUpper() ) )
276 q.removeAllQueryItems( param.first );
280 href = url.toString();
289 QStringList lst = bboxStr.split(
',' );
290 if ( lst.count() != 4 )
295 for (
int i = 0; i < 4; i++ )
297 lst[i].replace(
' ',
'+' );
298 d[i] = lst[i].toDouble( &ok );
This class represents a coordinate reference system (CRS).
static QgsCoordinateReferenceSystem fromOgcWmsCrs(const QString &ogcCrs)
Creates a CRS from a given OGC WMS-format Coordinate Reference System string.
Custom exception class for Coordinate Reference System related exceptions.
virtual QgsRectangle extent() const
Returns the extent of the layer.
QgsCoordinateReferenceSystem crs
QString abstract() const
Returns the abstract of the layer used by QGIS Server in GetCapabilities request.
QString shortName() const
Returns the short name of the layer used by QGIS Server to identify the layer.
QString title() const
Returns the title of the layer used by QGIS Server in GetCapabilities request.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
static QgsProject * instance()
Returns the QgsProject singleton instance.
Represents a raster layer.
int height() const
Returns the height of the (unclipped) raster.
int bandCount() const
Returns the number of bands in this layer.
double rasterUnitsPerPixelX() const
Returns the number of raster units per each raster pixel in X axis.
double rasterUnitsPerPixelY() const
Returns the number of raster units per each raster pixel in Y axis.
int width() const
Returns the width of the (unclipped) raster.
A rectangle specified with double values.
double yMaximum() const SIP_HOLDGIL
Returns the y maximum value (top side of rectangle).
double xMaximum() const SIP_HOLDGIL
Returns the x maximum value (right side of rectangle).
double xMinimum() const SIP_HOLDGIL
Returns the x minimum value (left side of rectangle).
double yMinimum() const SIP_HOLDGIL
Returns the y minimum value (bottom side of rectangle).
QgsServerRequest Class defining request interface passed to services QgsService::executeRequest() met...
QUrl originalUrl() const
Returns the request url as seen by the web server, by default this is equal to the url seen by QGIS s...
Provides a way to retrieve settings by prioritizing according to environment variables,...
SERVER_EXPORT QString wcsServiceUrl(const QgsProject &project, const QgsServerRequest &request=QgsServerRequest(), const QgsServerSettings &settings=QgsServerSettings())
Returns the WCS service url.
SERVER_EXPORT double ceilWithPrecision(double number, int places)
Returns a double greater than number to the specified number of places.
SERVER_EXPORT double floorWithPrecision(double number, int places)
Returns a double less than number to the specified number of places.
QDomElement getCoverageOffering(QDomDocument &doc, const QgsRasterLayer *layer, const QgsProject *project, bool brief)
CoverageOffering or CoverageOfferingBrief element.
QgsRectangle parseBbox(const QString &bboxStr)
Parse bounding box.
QString implementationVersion()
Returns the highest version supported by this implementation.
QString serviceUrl(const QgsServerRequest &request, const QgsProject *project, const QgsServerSettings &settings)
Service URL string.
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
CONSTLATIN1STRING geoEpsgCrsAuthId()
Geographic coord sys from EPSG authority.
#define QgsDebugError(str)