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 );
77 int wgs84precision = 6;
87 QgsDebugMsg( 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 QDomText lowText = doc.createTextNode( QStringLiteral(
"0 0" ) );
142 lowElem.appendChild( lowText );
143 gridEnvElem.appendChild( lowElem );
144 QDomElement highElem = doc.createElement( QStringLiteral(
"gml:high" ) );
145 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 QDomText xAxisText = doc.createTextNode( QStringLiteral(
"x" ) );
152 xAxisElem.appendChild( xAxisText );
153 spatialDomainElem.appendChild( xAxisElem );
155 QDomElement yAxisElem = doc.createElement( QStringLiteral(
"gml:axisName" ) );
156 QDomText yAxisText = doc.createTextNode( QStringLiteral(
"y" ) );
157 yAxisElem.appendChild( yAxisText );
158 spatialDomainElem.appendChild( yAxisElem );
160 QDomElement originElem = doc.createElement( QStringLiteral(
"gml:origin" ) );
161 QDomElement originPosElem = doc.createElement( QStringLiteral(
"gml:pos" ) );
163 originPosElem.appendChild( originPosText );
164 spatialDomainElem.appendChild( originElem );
166 QDomElement xOffsetElem = doc.createElement( QStringLiteral(
"gml:offsetVector" ) );
167 QDomText xOffsetText = doc.createTextNode( QString::number( layer->
rasterUnitsPerPixelX() ) +
" 0" );
168 xOffsetElem.appendChild( xOffsetText );
169 spatialDomainElem.appendChild( xOffsetElem );
171 QDomElement yOffsetElem = doc.createElement( QStringLiteral(
"gml:offsetVector" ) );
172 QDomText yOffsetText = doc.createTextNode(
"0 " + QString::number( layer->
rasterUnitsPerPixelY() ) );
173 yOffsetElem.appendChild( yOffsetText );
174 spatialDomainElem.appendChild( yOffsetElem );
177 QDomElement rangeSetElem = doc.createElement( QStringLiteral(
"rangeSet" ) );
178 layerElem.appendChild( rangeSetElem );
187 QDomElement RangeSetElem = doc.createElement( QStringLiteral(
"RangeSet" ) );
188 rangeSetElem.appendChild( RangeSetElem );
190 QDomElement rsNameElem = doc.createElement( QStringLiteral(
"name" ) );
191 QDomText rsNameText = doc.createTextNode( QStringLiteral(
"Bands" ) );
192 rsNameElem.appendChild( rsNameText );
193 RangeSetElem.appendChild( rsNameElem );
195 QDomElement axisDescElem = doc.createElement( QStringLiteral(
"axisDescription" ) );
196 RangeSetElem.appendChild( axisDescElem );
198 QDomElement AxisDescElem = doc.createElement( QStringLiteral(
"AxisDescription" ) );
199 axisDescElem.appendChild( AxisDescElem );
201 QDomElement adNameElem = doc.createElement( QStringLiteral(
"name" ) );
202 QDomText adNameText = doc.createTextNode( QStringLiteral(
"bands" ) );
203 adNameElem.appendChild( adNameText );
204 AxisDescElem.appendChild( adNameElem );
206 QDomElement adValuesElem = doc.createElement( QStringLiteral(
"values" ) );
207 for (
int idx = 0; idx < layer->
bandCount(); ++idx )
209 QDomElement adValueElem = doc.createElement( QStringLiteral(
"value" ) );
210 QDomText adValueText = doc.createTextNode( QString::number( idx + 1 ) );
211 adValueElem.appendChild( adValueText );
212 adValuesElem.appendChild( adValueElem );
214 AxisDescElem.appendChild( adValuesElem );
218 QDomElement sCRSElem = doc.createElement( QStringLiteral(
"supportedCRSs" ) );
219 QDomElement rCRSElem = doc.createElement( QStringLiteral(
"requestResponseCRSs" ) );
220 QDomText rCRSText = doc.createTextNode( layerCrs.
authid() );
221 rCRSElem.appendChild( rCRSText );
222 sCRSElem.appendChild( rCRSElem );
223 QDomElement nCRSElem = doc.createElement( QStringLiteral(
"nativeCRSs" ) );
224 QDomText nCRSText = doc.createTextNode( layerCrs.
authid() );
225 nCRSElem.appendChild( nCRSText );
226 sCRSElem.appendChild( nCRSElem );
227 layerElem.appendChild( sCRSElem );
231 QDomElement sFormatsElem = doc.createElement( QStringLiteral(
"supportedFormats" ) );
232 sFormatsElem.setAttribute( QStringLiteral(
"nativeFormat" ), QStringLiteral(
"raw binary" ) );
233 QDomElement formatsElem = doc.createElement( QStringLiteral(
"formats" ) );
234 QDomText formatsText = doc.createTextNode( QStringLiteral(
"GeoTIFF" ) );
235 formatsElem.appendChild( formatsText );
236 sFormatsElem.appendChild( formatsElem );
237 layerElem.appendChild( sFormatsElem );
245 static QSet< QString > sFilter
247 QStringLiteral(
"REQUEST" ),
248 QStringLiteral(
"VERSION" ),
249 QStringLiteral(
"SERVICE" ),
250 QStringLiteral(
"_DC" )
260 if ( href.isEmpty() )
265 for (
auto param : q.queryItems() )
267 if ( sFilter.contains( param.first.toUpper() ) )
268 q.removeAllQueryItems( param.first );
272 href = url.toString();
281 QStringList lst = bboxStr.split(
',' );
282 if ( lst.count() != 4 )
287 for (
int i = 0; i < 4; i++ )
289 lst[i].replace(
' ',
'+' );
290 d[i] = lst[i].toDouble( &ok );
A rectangle specified with double values.
double rasterUnitsPerPixelY() const
Returns the number of raster units per each raster pixel in Y axis.
QString shortName() const
Returns the short name of the layer used by QGIS Server to identify the layer.
QgsRectangle parseBbox(const QString &bboxStr)
Parse bounding box.
double yMaximum() const
Returns the y maximum value (top side of rectangle).
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 title() const
Returns the title of the layer used by QGIS Server in GetCapabilities request.
QString serviceUrl(const QgsServerRequest &request, const QgsProject *project)
Service URL string.
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...
int height() const
Returns the height of the (unclipped) raster.
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
int bandCount() const
Returns the number of bands in this layer.
double xMaximum() const
Returns the x maximum value (right side of rectangle).
virtual QgsRectangle extent() const
Returns the extent of the layer.
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
SERVER_EXPORT double floorWithPrecision(double number, int places)
Returns a double less than number to the specified number of places.
Reads and writes project states.
const QString GEO_EPSG_CRS_AUTHID
Geographic coord sys from EPSG authority.
QString abstract() const
Returns the abstract of the layer used by QGIS Server in GetCapabilities request. ...
SERVER_EXPORT double ceilWithPrecision(double number, int places)
Returns a double greater than number to the specified number of places.
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.
static QgsCoordinateReferenceSystem fromOgcWmsCrs(const QString &ogcCrs)
Creates a CRS from a given OGC WMS-format Coordinate Reference System string.
This class represents a coordinate reference system (CRS).
QString authid() const
Returns the authority identifier for the CRS.
Custom exception class for Coordinate Reference System related exceptions.
bool isGeographic() const
Returns whether the CRS is a geographic CRS (using lat/lon coordinates)
double xMinimum() const
Returns the x minimum value (left side of rectangle).
QgsCoordinateReferenceSystem crs
int width() const
Returns the width of the (unclipped) raster.