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 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 QDomText labelText = doc.createTextNode( title );
61 labelElem.appendChild( labelText );
62 layerElem.appendChild( labelElem );
65 QString
abstract = layer->
abstract();
66 if ( !
abstract.isEmpty() )
68 QDomElement descriptionElem = doc.createElement( QStringLiteral(
"description" ) );
69 QDomText descriptionText = doc.createTextNode(
abstract );
70 descriptionElem.appendChild( descriptionText );
71 layerElem.appendChild( descriptionElem );
85 QgsDebugMsg( QStringLiteral(
"Transform error caught: %1. Using original layer extent." ).arg( e.
what() ) );
88 QDomElement lonLatElem = doc.createElement( QStringLiteral(
"lonLatEnvelope" ) );
89 lonLatElem.setAttribute( QStringLiteral(
"srsName" ), QStringLiteral(
"urn:ogc:def:crs:OGC:1.3:CRS84" ) );
90 QDomElement lowerPosElem = doc.createElement( QStringLiteral(
"gml:pos" ) );
91 QDomText lowerPosText = doc.createTextNode( QString::number( BBox.
xMinimum() ) +
" " + QString::number( BBox.
yMinimum() ) );
92 lowerPosElem.appendChild( lowerPosText );
93 lonLatElem.appendChild( lowerPosElem );
94 QDomElement upperPosElem = doc.createElement( QStringLiteral(
"gml:pos" ) );
95 QDomText upperPosText = doc.createTextNode( QString::number( BBox.
xMaximum() ) +
" " + QString::number( BBox.
yMaximum() ) );
96 upperPosElem.appendChild( upperPosText );
97 lonLatElem.appendChild( upperPosElem );
98 layerElem.appendChild( lonLatElem );
106 QDomElement domainSetElem = doc.createElement( QStringLiteral(
"domainSet" ) );
107 layerElem.appendChild( domainSetElem );
109 QDomElement spatialDomainElem = doc.createElement( QStringLiteral(
"spatialDomain" ) );
110 domainSetElem.appendChild( spatialDomainElem );
113 QDomElement envelopeElem = doc.createElement( QStringLiteral(
"gml:Envelope" ) );
114 envelopeElem.setAttribute( QStringLiteral(
"srsName" ), layerCrs.
authid() );
115 QDomElement lowerCornerElem = doc.createElement( QStringLiteral(
"gml:pos" ) );
116 QDomText lowerCornerText = doc.createTextNode( QString::number( layerBBox.
xMinimum() ) +
" " + QString::number( layerBBox.
yMinimum() ) );
117 lowerCornerElem.appendChild( lowerCornerText );
118 envelopeElem.appendChild( lowerCornerElem );
119 QDomElement upperCornerElem = doc.createElement( QStringLiteral(
"gml:pos" ) );
120 QDomText upperCornerText = doc.createTextNode( QString::number( layerBBox.
xMaximum() ) +
" " + QString::number( layerBBox.
yMaximum() ) );
121 upperCornerElem.appendChild( upperCornerText );
122 envelopeElem.appendChild( upperCornerElem );
123 spatialDomainElem.appendChild( envelopeElem );
125 QDomElement rectGridElem = doc.createElement( QStringLiteral(
"gml:RectifiedGrid" ) );
126 rectGridElem.setAttribute( QStringLiteral(
"dimension" ), 2 );
127 QDomElement limitsElem = doc.createElement( QStringLiteral(
"gml:limits" ) );
128 rectGridElem.appendChild( limitsElem );
129 QDomElement gridEnvElem = doc.createElement( QStringLiteral(
"gml:GridEnvelope" ) );
130 limitsElem.appendChild( gridEnvElem );
131 QDomElement lowElem = doc.createElement( QStringLiteral(
"gml:low" ) );
132 QDomText lowText = doc.createTextNode( QStringLiteral(
"0 0" ) );
133 lowElem.appendChild( lowText );
134 gridEnvElem.appendChild( lowElem );
135 QDomElement highElem = doc.createElement( QStringLiteral(
"gml:high" ) );
136 QDomText highText = doc.createTextNode( QString::number( layer->
width() ) +
" " + QString::number( layer->
height() ) );
137 highElem.appendChild( highText );
138 gridEnvElem.appendChild( highElem );
139 spatialDomainElem.appendChild( rectGridElem );
141 QDomElement xAxisElem = doc.createElement( QStringLiteral(
"gml:axisName" ) );
142 QDomText xAxisText = doc.createTextNode( QStringLiteral(
"x" ) );
143 xAxisElem.appendChild( xAxisText );
144 spatialDomainElem.appendChild( xAxisElem );
146 QDomElement yAxisElem = doc.createElement( QStringLiteral(
"gml:axisName" ) );
147 QDomText yAxisText = doc.createTextNode( QStringLiteral(
"y" ) );
148 yAxisElem.appendChild( yAxisText );
149 spatialDomainElem.appendChild( yAxisElem );
151 QDomElement originElem = doc.createElement( QStringLiteral(
"gml:origin" ) );
152 QDomElement originPosElem = doc.createElement( QStringLiteral(
"gml:pos" ) );
153 QDomText originPosText = doc.createTextNode( QString::number( layerBBox.
xMinimum() ) +
" " + QString::number( layerBBox.
yMaximum() ) );
154 originPosElem.appendChild( originPosText );
155 spatialDomainElem.appendChild( originElem );
157 QDomElement xOffsetElem = doc.createElement( QStringLiteral(
"gml:offsetVector" ) );
158 QDomText xOffsetText = doc.createTextNode( QString::number( layer->
rasterUnitsPerPixelX() ) +
" 0" );
159 xOffsetElem.appendChild( xOffsetText );
160 spatialDomainElem.appendChild( xOffsetElem );
162 QDomElement yOffsetElem = doc.createElement( QStringLiteral(
"gml:offsetVector" ) );
163 QDomText yOffsetText = doc.createTextNode(
"0 " + QString::number( layer->
rasterUnitsPerPixelY() ) );
164 yOffsetElem.appendChild( yOffsetText );
165 spatialDomainElem.appendChild( yOffsetElem );
168 QDomElement rangeSetElem = doc.createElement( QStringLiteral(
"rangeSet" ) );
169 layerElem.appendChild( rangeSetElem );
178 QDomElement RangeSetElem = doc.createElement( QStringLiteral(
"RangeSet" ) );
179 rangeSetElem.appendChild( RangeSetElem );
181 QDomElement rsNameElem = doc.createElement( QStringLiteral(
"name" ) );
182 QDomText rsNameText = doc.createTextNode( QStringLiteral(
"Bands" ) );
183 rsNameElem.appendChild( rsNameText );
184 RangeSetElem.appendChild( rsNameElem );
186 QDomElement axisDescElem = doc.createElement( QStringLiteral(
"axisDescription" ) );
187 RangeSetElem.appendChild( axisDescElem );
189 QDomElement AxisDescElem = doc.createElement( QStringLiteral(
"AxisDescription" ) );
190 axisDescElem.appendChild( AxisDescElem );
192 QDomElement adNameElem = doc.createElement( QStringLiteral(
"name" ) );
193 QDomText adNameText = doc.createTextNode( QStringLiteral(
"bands" ) );
194 adNameElem.appendChild( adNameText );
195 AxisDescElem.appendChild( adNameElem );
197 QDomElement adValuesElem = doc.createElement( QStringLiteral(
"values" ) );
198 for (
int idx = 0; idx < layer->
bandCount(); ++idx )
200 QDomElement adValueElem = doc.createElement( QStringLiteral(
"value" ) );
201 QDomText adValueText = doc.createTextNode( QString::number( idx + 1 ) );
202 adValueElem.appendChild( adValueText );
203 adValuesElem.appendChild( adValueElem );
205 AxisDescElem.appendChild( adValuesElem );
209 QDomElement sCRSElem = doc.createElement( QStringLiteral(
"supportedCRSs" ) );
210 QDomElement rCRSElem = doc.createElement( QStringLiteral(
"requestResponseCRSs" ) );
211 QDomText rCRSText = doc.createTextNode( layerCrs.
authid() );
212 rCRSElem.appendChild( rCRSText );
213 sCRSElem.appendChild( rCRSElem );
214 QDomElement nCRSElem = doc.createElement( QStringLiteral(
"nativeCRSs" ) );
215 QDomText nCRSText = doc.createTextNode( layerCrs.
authid() );
216 nCRSElem.appendChild( nCRSText );
217 sCRSElem.appendChild( nCRSElem );
218 layerElem.appendChild( sCRSElem );
222 QDomElement sFormatsElem = doc.createElement( QStringLiteral(
"supportedFormats" ) );
223 sFormatsElem.setAttribute( QStringLiteral(
"nativeFormat" ), QStringLiteral(
"raw binary" ) );
224 QDomElement formatsElem = doc.createElement( QStringLiteral(
"formats" ) );
225 QDomText formatsText = doc.createTextNode( QStringLiteral(
"GeoTIFF" ) );
226 formatsElem.appendChild( formatsText );
227 sFormatsElem.appendChild( formatsElem );
228 layerElem.appendChild( sFormatsElem );
236 static QSet< QString > sFilter
238 QStringLiteral(
"REQUEST" ),
239 QStringLiteral(
"VERSION" ),
240 QStringLiteral(
"SERVICE" ),
241 QStringLiteral(
"_DC" )
251 if ( href.isEmpty() )
256 for (
auto param : q.queryItems() )
258 if ( sFilter.contains( param.first.toUpper() ) )
259 q.removeAllQueryItems( param.first );
263 href = url.toString();
272 QStringList lst = bboxStr.split(
',' );
273 if ( lst.count() != 4 )
278 for (
int i = 0; i < 4; i++ )
280 lst[i].replace(
' ',
'+' );
281 d[i] = lst[i].toDouble( &ok );
int width() const
Returns the width of the (unclipped) raster.
A rectangle specified with double values.
QgsRectangle parseBbox(const QString &bboxStr)
Parse bounding box.
int bandCount() const
Returns the number of bands in this layer.
QString shortName() const
Returns the short name of the layer used by QGIS Server to identify the layer.
This class provides qgis with the ability to render raster datasets onto the mapcanvas.
double rasterUnitsPerPixelX() const
Returns the number of raster units per each raster pixel in X axis.
QString abstract() const
Returns the abstract of the layer used by QGIS Server in GetCapabilities request. ...
QString serviceUrl(const QgsServerRequest &request, const QgsProject *project)
Service URL string.
double rasterUnitsPerPixelY() const
Returns the number of raster units per each raster pixel in Y axis.
int height() const
Returns the height of the (unclipped) raster.
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...
virtual QgsRectangle extent() const
Returns the extent of the layer.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts, annotations, canvases, etc.
QString title() const
Returns the title of the layer used by QGIS Server in GetCapabilities request.
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
double xMaximum() const
Returns the x maximum value (right side of rectangle).
QgsServerRequest Class defining request interface passed to services QgsService::executeRequest() met...
QString implementationVersion()
Returns the highest version supported by this implementation.
QDomElement getCoverageOffering(QDomDocument &doc, const QgsRasterLayer *layer, const QgsProject *project, bool brief)
CoverageOffering or CoverageOfferingBrief element.
SERVER_EXPORT QString wcsServiceUrl(const QgsProject &project)
Returns the WCS service url defined in a QGIS project.
This class represents a coordinate reference system (CRS).
double xMinimum() const
Returns the x minimum value (left side of rectangle).
double yMaximum() const
Returns the y maximum value (top side of rectangle).
Custom exception class for Coordinate Reference System related exceptions.
QString authid() const
Returns the authority identifier for the CRS.
QgsCoordinateReferenceSystem crs