20#include <QTemporaryFile>
45 response.
setHeader(
"Content-Type",
"image/tiff" );
52#ifdef HAVE_SERVER_PYTHON_PLUGINS
60 const QMap<QString, QString>::const_iterator cove_name_it = parameters.constFind( QStringLiteral(
"COVERAGE" ) );
61 if ( cove_name_it != parameters.constEnd() )
63 coveName = cove_name_it.value();
65 if ( coveName.isEmpty() )
67 const QMap<QString, QString>::const_iterator cove_name_it = parameters.constFind( QStringLiteral(
"IDENTIFIER" ) );
68 if ( cove_name_it != parameters.constEnd() )
70 coveName = cove_name_it.value();
74 if ( coveName.isEmpty() )
83 for (
int i = 0; i < wcsLayersId.size(); ++i )
94#ifdef HAVE_SERVER_PYTHON_PLUGINS
100 QString name = layer->
name();
103 name = name.replace( QLatin1String(
" " ), QLatin1String(
"_" ) );
105 if ( name == coveName )
107 rLayer = qobject_cast<QgsRasterLayer *>( layer );
116 double minx = 0.0, miny = 0.0, maxx = 0.0, maxy = 0.0;
118 int width = 0, height = 0;
137 bool conversionSuccess =
false;
138 width = parameters.value( QStringLiteral(
"WIDTH" ), QStringLiteral(
"0" ) ).toInt( &conversionSuccess );
139 if ( !conversionSuccess )
144 height = parameters.value( QStringLiteral(
"HEIGHT" ), QStringLiteral(
"0" ) ).toInt( &conversionSuccess );
145 if ( !conversionSuccess )
150 if ( width < 0 || height < 0 )
155 crs = parameters.value( QStringLiteral(
"CRS" ) );
170 if ( requestCRS != rLayer->
crs() )
178 crs = parameters.value( QStringLiteral(
"RESPONSE_CRS" ) );
179 if ( !
crs.isEmpty() )
184 responseCRS = rLayer->
crs();
188 QTemporaryFile tempFile;
200 if ( responseCRS != rLayer->
crs() )
204 if ( !pipe.
insert( 2, projector ) )
215 return tempFile.readAll();
RasterFileWriterResult
Raster file export results.
@ Success
Successful export.
A helper class that centralizes restrictions given by all the access control filter plugins.
bool layerReadPermission(const QgsMapLayer *layer) const
Returns the layer read right.
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.
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
QString shortName() const
Returns the short name of the layer used by QGIS Server to identify the layer.
Base class for all map layer types.
QgsCoordinateReferenceSystem crs
QgsMapLayerServerProperties * serverProperties()
Returns QGIS Server Properties for the map layer.
QgsCoordinateTransformContext transformContext() const
Returns the layer data provider coordinate transform context or a default transform context if the la...
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Q_INVOKABLE QgsMapLayer * mapLayer(const QString &layerId) const
Retrieve a pointer to a registered layer by layer ID.
QgsRasterDataProvider * clone() const override=0
Clone itself, create deep copy.
The raster file writer which allows you to save a raster to a new file.
Q_DECL_DEPRECATED Qgis::RasterFileWriterResult writeRaster(const QgsRasterPipe *pipe, int nCols, int nRows, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &crs, QgsRasterBlockFeedback *feedback=nullptr) SIP_DEPRECATED
Write raster file.
Represents a raster layer.
QgsRasterDataProvider * dataProvider() override
Returns the source data provider.
Contains a pipeline of raster interfaces for sequential raster processing.
bool set(QgsRasterInterface *interface)
Inserts a new known interface in default place or replace interface of the same role if it already ex...
bool insert(int idx, QgsRasterInterface *interface)
Attempts to insert interface at specified index and connect if connection would fail,...
Implements approximate projection support for optimised raster transformation.
Q_DECL_DEPRECATED void setCrs(const QgsCoordinateReferenceSystem &srcCRS, const QgsCoordinateReferenceSystem &destCRS, int srcDatumTransform=-1, int destDatumTransform=-1)
Sets the source and destination CRS.
A rectangle specified with double values.
QgsServerInterface Class defining interfaces exposed by QGIS Server and made available to plugins.
virtual QgsAccessControl * accessControls() const =0
Gets the registered access control filters.
QgsServerRequest Class defining request interface passed to services QgsService::executeRequest() met...
QgsServerRequest::Parameters parameters() const
Returns a map of query parameters with keys converted to uppercase.
QMap< QString, QString > Parameters
QgsServerResponse Class defining response interface passed to services QgsService::executeRequest() m...
virtual void write(const QString &data)
Write string This is a convenient method that will write directly to the underlying I/O device.
virtual void setHeader(const QString &key, const QString &value)=0
Set Header entry Add Header entry to the response Note that it is usually an error to set Header afte...
SERVER_EXPORT QStringList wcsLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published in WCS.
QgsRectangle parseBbox(const QString &bboxStr)
Parse bounding box.
void writeGetCoverage(QgsServerInterface *serverIface, const QgsProject *project, const QString &version, const QgsServerRequest &request, QgsServerResponse &response)
Output WCS DescribeCoverage response.
QByteArray getCoverageData(QgsServerInterface *serverIface, const QgsProject *project, const QgsServerRequest &request)
Compute coverage data.
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
const QgsCoordinateReferenceSystem & crs