Skip to content
Permalink
Browse files

[FEATURE][QGIS-Server] Add Web Coverage Service support : funded Ifremer

QGIS-Server already supports standards : Web Map Service (WMS version 1.3.0
and 1.1.1) and Web Feature Service (WFS version 1.0.0) and Web Feature
Service with Transaction (WFS-T).
The French Research Institute, Ifremer, would like that QGIS-Server supports
all the OGC standards.
We (3Liz) are implementing the Web Coverage Service (WCS version 1.0.0)
support in QGIS-Server.
  • Loading branch information
rldhont committed Dec 10, 2013
1 parent 4bbce14 commit 2573cc2f3dec8d77a7aec915800b5d82b8ffd906
@@ -26,6 +26,7 @@ SET ( qgis_mapserv_SRCS
qgssldparser.cpp
qgswmsserver.cpp
qgswfsserver.cpp
qgswcsserver.cpp
qgsmapserviceexception.cpp
qgsmslayercache.cpp
qgsfilter.cpp
@@ -27,6 +27,7 @@ map service syntax for SOAP/HTTP POST
#include "qgslogger.h"
#include "qgswmsserver.h"
#include "qgswfsserver.h"
#include "qgswcsserver.h"
#include "qgsmaprenderer.h"
#include "qgsmapserviceexception.h"
#include "qgspallabeling.h"
@@ -346,7 +347,99 @@ int main( int argc, char * argv[] )
}

QgsWMSServer* theServer = 0;
if ( serviceString == "WFS" )
if ( serviceString == "WCS" )
{
delete theServer;
QgsWCSServer* theServer = 0;
try
{
theServer = new QgsWCSServer( parameterMap );
}
catch ( QgsMapServiceException e ) //admin.sld may be invalid
{
theRequestHandler->sendServiceException( e );
continue;
}

theServer->setAdminConfigParser( adminConfigParser );


//request type
QString request = parameterMap.value( "REQUEST" );
if ( request.isEmpty() )
{
//do some error handling
QgsDebugMsg( "unable to find 'REQUEST' parameter, exiting..." );
theRequestHandler->sendServiceException( QgsMapServiceException( "OperationNotSupported", "Please check the value of the REQUEST parameter" ) );
delete theRequestHandler;
delete theServer;
continue;
}

if ( request.compare( "GetCapabilities", Qt::CaseInsensitive ) == 0 )
{
QDomDocument capabilitiesDocument;
try
{
capabilitiesDocument = theServer->getCapabilities();
}
catch ( QgsMapServiceException& ex )
{
theRequestHandler->sendServiceException( ex );
delete theRequestHandler;
delete theServer;
continue;
}
QgsDebugMsg( "sending GetCapabilities response" );
theRequestHandler->sendGetCapabilitiesResponse( capabilitiesDocument );
delete theRequestHandler;
delete theServer;
continue;
}
else if ( request.compare( "DescribeCoverage", Qt::CaseInsensitive ) == 0 )
{
QDomDocument describeDocument;
try
{
describeDocument = theServer->describeCoverage();
}
catch ( QgsMapServiceException& ex )
{
theRequestHandler->sendServiceException( ex );
delete theRequestHandler;
delete theServer;
continue;
}
QgsDebugMsg( "sending GetCapabilities response" );
theRequestHandler->sendGetCapabilitiesResponse( describeDocument );
delete theRequestHandler;
delete theServer;
continue;
}
else if ( request.compare( "GetCoverage", Qt::CaseInsensitive ) == 0 )
{
QByteArray* coverageOutput;
try
{
coverageOutput = theServer->getCoverage();
}
catch ( QgsMapServiceException& ex )
{
theRequestHandler->sendServiceException( ex );
delete theRequestHandler;
delete theServer;
continue;
}
if ( coverageOutput )
{
theRequestHandler->sendGetCoverageResponse( coverageOutput );
}
delete theRequestHandler;
delete theServer;
continue;
}
}
else if ( serviceString == "WFS" )
{
delete theServer;
QgsWFSServer* theServer = 0;
@@ -49,12 +49,19 @@ class QgsConfigParser

virtual void featureTypeList( QDomElement& parentElement, QDomDocument& doc ) const = 0;

virtual void wcsContentMetadata( QDomElement& parentElement, QDomDocument& doc ) const = 0;

virtual void owsGeneralAndResourceList( QDomElement& parentElement, QDomDocument& doc, const QString& strHref ) const = 0;

virtual void describeFeatureType( const QString& aTypeName, QDomElement& parentElement, QDomDocument& doc ) const = 0;

virtual void describeCoverage( const QString& aCoveName, QDomElement& parentElement, QDomDocument& doc ) const = 0;
/**Returns one or possibly several maplayers for a given type name. If no layers are found, an empty list is returned*/
virtual QList<QgsMapLayer*> mapLayerFromTypeName( const QString& tName, bool useCache = true ) const = 0;

/**Returns one or possibly several maplayers for a given type name. If no layers are found, an empty list is returned*/
virtual QList<QgsMapLayer*> mapLayerFromCoverage( const QString& cName, bool useCache = true ) const = 0;

/**Returns one or possibly several maplayers for a given layer name and style. If there are several layers, the layers should be drawn in inverse list order.
If no layers/style are found, an empty list is returned
@param allowCache true if layer can be read from / written to cache*/
@@ -362,6 +362,11 @@ void QgsHttpRequestHandler::endGetFeatureResponse( QByteArray* ba ) const
fwrite( ba->data(), ba->size(), 1, FCGI_stdout );
}

void QgsHttpRequestHandler::sendGetCoverageResponse( QByteArray* ba ) const
{
sendHttpResponse( ba, "image/tiff" );
}

void QgsHttpRequestHandler::requestStringToParameterMap( const QString& request, QMap<QString, QString>& parameters )
{
parameters.clear();
@@ -42,6 +42,7 @@ class QgsHttpRequestHandler: public QgsRequestHandler
virtual bool startGetFeatureResponse( QByteArray* ba, const QString& infoFormat ) const;
virtual void sendGetFeatureResponse( QByteArray* ba ) const;
virtual void endGetFeatureResponse( QByteArray* ba ) const;
virtual void sendGetCoverageResponse( QByteArray* ba ) const;

protected:
void sendHttpResponse( QByteArray* ba, const QString& format ) const;

0 comments on commit 2573cc2

Please sign in to comment.
You can’t perform that action at this time.