20 #include <QTemporaryFile> 46 response.
setHeader(
"Content-Type",
"image/tiff" );
53 #ifdef HAVE_SERVER_PYTHON_PLUGINS 59 QMap<QString, QString>::const_iterator cove_name_it = parameters.constFind( QStringLiteral(
"COVERAGE" ) );
60 if ( cove_name_it != parameters.constEnd() )
62 coveName = cove_name_it.value();
64 if ( coveName.isEmpty() )
66 QMap<QString, QString>::const_iterator cove_name_it = parameters.constFind( QStringLiteral(
"IDENTIFIER" ) );
67 if ( cove_name_it != parameters.constEnd() )
69 coveName = cove_name_it.value();
73 if ( coveName.isEmpty() )
82 for (
int i = 0; i < wcsLayersId.size(); ++i )
89 if ( layer->
type() != QgsMapLayer::LayerType::RasterLayer )
93 #ifdef HAVE_SERVER_PYTHON_PLUGINS 99 QString name = layer->
name();
102 name = name.replace( QLatin1String(
" " ), QLatin1String(
"_" ) );
104 if ( name == coveName )
115 double minx = 0.0, miny = 0.0, maxx = 0.0, maxy = 0.0;
117 int width = 0, height = 0;
136 bool conversionSuccess =
false;
137 width = parameters.value( QStringLiteral(
"WIDTH" ), QStringLiteral(
"0" ) ).toInt( &conversionSuccess );
138 if ( !conversionSuccess )
143 height = parameters.value( QStringLiteral(
"HEIGHT" ), QStringLiteral(
"0" ) ).toInt( &conversionSuccess );
144 if ( !conversionSuccess )
149 if ( width < 0 || height < 0 )
154 crs = parameters.value( QStringLiteral(
"CRS" ) );
169 if ( requestCRS != rLayer->
crs() )
172 rect = t.transformBoundingBox( rect );
177 crs = parameters.value( QStringLiteral(
"RESPONSE_CRS" ) );
178 if ( !crs.isEmpty() )
183 responseCRS = rLayer->
crs();
187 QTemporaryFile tempFile;
199 if ( responseCRS != rLayer->
crs() )
202 projector->
setCrs( rLayer->
crs(), responseCRS );
203 if ( !pipe.insert( 2, projector ) )
214 return tempFile.readAll();
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...
A rectangle specified with double values.
Base class for all map layer types.
Base class for processing modules.
QgsRectangle parseBbox(const QString &bboxStr)
Parse bounding box.
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.
QgsRasterInterface * clone() const override=0
Clone itself, create deep copy.
const QgsCoordinateReferenceSystem & crs
virtual void write(const QString &data)
Write string This is a convenient method that will write directly to the underlying I/O device...
QgsMapLayer::LayerType type() const
Returns the type of the layer.
void setCrs(const QgsCoordinateReferenceSystem &srcCRS, const QgsCoordinateReferenceSystem &destCRS, int srcDatumTransform=-1, int destDatumTransform=-1)
Sets the source and destination CRS.
QgsRasterDataProvider * dataProvider() override
Returns the layer's data provider, it may be null.
bool isEmpty() const
Returns true if the rectangle is empty.
QgsServerRequest::Parameters parameters() const
Returns a map of query parameters with keys converted to uppercase.
SERVER_EXPORT QStringList wcsLayerIds(const QgsProject &project)
Returns the Layer ids list defined in a QGIS project as published in WCS.
Reads and writes project states.
double yMinimum() const
Returns the y minimum value (bottom side of rectangle).
double xMaximum() const
Returns the x maximum value (right side of rectangle).
QgsRasterProjector implements approximate projection support for it calculates grid of points in sour...
QgsServerRequest Class defining request interface passed to services QgsService::executeRequest() met...
bool layerReadPermission(const QgsMapLayer *layer) const
Returns the layer read right.
QgsServerInterface Class defining interfaces exposed by QGIS Server and made available to plugins...
void writeGetCoverage(QgsServerInterface *serverIface, const QgsProject *project, const QString &version, const QgsServerRequest &request, QgsServerResponse &response)
Output WCS DescribeCoverage response.
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).
double xMinimum() const
Returns the x minimum value (left side of rectangle).
A helper class that centralizes restrictions given by all the access control filter plugins...
QgsMapLayer * mapLayer(const QString &layerId) const
Retrieve a pointer to a registered layer by layer ID.
double yMaximum() const
Returns the y maximum value (top side of rectangle).
QgsServerResponse Class defining response interface passed to services QgsService::executeRequest() m...
virtual QgsAccessControl * accessControls() const =0
Gets the registered access control filters.
QgsCoordinateReferenceSystem crs
QMap< QString, QString > Parameters
QByteArray getCoverageData(QgsServerInterface *serverIface, const QgsProject *project, const QgsServerRequest &request)
Compute coverage data.
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
The raster file writer which allows you to save a raster to a new file.