mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
wcs test - improved report, servers list in json
This commit is contained in:
parent
212145d902
commit
b1e00e950c
@ -187,6 +187,32 @@ void QgsWcsCapabilities::clear()
|
|||||||
mCapabilities = c;
|
mCapabilities = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString QgsWcsCapabilities::getCapabilitiesUrl( const QString version ) const
|
||||||
|
{
|
||||||
|
QString url = prepareUri( mUri.param( "url" ) ) + "SERVICE=WCS&REQUEST=GetCapabilities";
|
||||||
|
|
||||||
|
if ( !version.isEmpty() )
|
||||||
|
{
|
||||||
|
// 1.0.0 - VERSION
|
||||||
|
// 1.1.0 - AcceptVersions (not supported by UMN Mapserver 6.0.3 - defaults to latest 1.1
|
||||||
|
if ( version.startsWith( "1.0" ) )
|
||||||
|
{
|
||||||
|
url += "&VERSION=" + version;
|
||||||
|
}
|
||||||
|
else if ( version.startsWith( "1.1" ) )
|
||||||
|
{
|
||||||
|
// Ignored by UMN Mapserver 6.0.3, see below
|
||||||
|
url += "&AcceptVersions=" + version;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QgsWcsCapabilities::getCapabilitiesUrl( ) const
|
||||||
|
{
|
||||||
|
return getCapabilitiesUrl( mVersion );
|
||||||
|
}
|
||||||
|
|
||||||
bool QgsWcsCapabilities::retrieveServerCapabilities( )
|
bool QgsWcsCapabilities::retrieveServerCapabilities( )
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
@ -196,21 +222,10 @@ bool QgsWcsCapabilities::retrieveServerCapabilities( )
|
|||||||
|
|
||||||
if ( !preferredVersion.isEmpty() )
|
if ( !preferredVersion.isEmpty() )
|
||||||
{
|
{
|
||||||
// This is not
|
versions << preferredVersion;
|
||||||
if ( preferredVersion.startsWith( "1.0" ) )
|
|
||||||
{
|
|
||||||
versions << "VERSION=" + preferredVersion;
|
|
||||||
}
|
|
||||||
else if ( preferredVersion.startsWith( "1.1" ) )
|
|
||||||
{
|
|
||||||
// Ignored by UMN Mapserver 6.0.3, see below
|
|
||||||
versions << "AcceptVersions=" + preferredVersion;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 1.0.0 - VERSION
|
|
||||||
// 1.1.0 - AcceptVersions (not supported by UMN Mapserver 6.0.3 - defaults to latest 1.1
|
|
||||||
// We prefer 1.0 because 1.1 has many issues, each server implements it in defferent
|
// We prefer 1.0 because 1.1 has many issues, each server implements it in defferent
|
||||||
// way with various particularities
|
// way with various particularities
|
||||||
// It may happen that server supports 1.1.0 but gives error for 1.1
|
// It may happen that server supports 1.1.0 but gives error for 1.1
|
||||||
@ -232,12 +247,7 @@ bool QgsWcsCapabilities::retrieveServerCapabilities( QString preferredVersion )
|
|||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
QString url = prepareUri( mUri.param( "url" ) ) + "SERVICE=WCS&REQUEST=GetCapabilities";
|
QString url = getCapabilitiesUrl( preferredVersion );
|
||||||
|
|
||||||
if ( !preferredVersion.isEmpty() )
|
|
||||||
{
|
|
||||||
url += "&" + preferredVersion;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! sendRequest( url ) ) { return false; }
|
if ( ! sendRequest( url ) ) { return false; }
|
||||||
|
|
||||||
@ -261,6 +271,23 @@ bool QgsWcsCapabilities::retrieveServerCapabilities( QString preferredVersion )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString QgsWcsCapabilities::getDescribeCoverageUrl( QString const &identifier ) const
|
||||||
|
{
|
||||||
|
QString url = prepareUri( mUri.param( "url" ) ) + "SERVICE=WCS&REQUEST=DescribeCoverage&VERSION=" + mVersion;
|
||||||
|
|
||||||
|
if ( mVersion.startsWith( "1.0" ) )
|
||||||
|
{
|
||||||
|
url += "&COVERAGE=" + identifier;
|
||||||
|
}
|
||||||
|
else if ( mVersion.startsWith( "1.1" ) )
|
||||||
|
{
|
||||||
|
// in 1.1.0, 1.1.1, 1.1.2 the name of param is 'identifier'
|
||||||
|
// but in KVP 'identifiers'
|
||||||
|
url += "&IDENTIFIERS=" + identifier;
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
bool QgsWcsCapabilities::describeCoverage( QString const &identifier, bool forceRefresh )
|
bool QgsWcsCapabilities::describeCoverage( QString const &identifier, bool forceRefresh )
|
||||||
{
|
{
|
||||||
QgsDebugMsg( " identifier = " + identifier );
|
QgsDebugMsg( " identifier = " + identifier );
|
||||||
@ -274,18 +301,7 @@ bool QgsWcsCapabilities::describeCoverage( QString const &identifier, bool force
|
|||||||
|
|
||||||
if ( coverage->described && ! forceRefresh ) return true;
|
if ( coverage->described && ! forceRefresh ) return true;
|
||||||
|
|
||||||
QString url = prepareUri( mUri.param( "url" ) ) + "SERVICE=WCS&REQUEST=DescribeCoverage&VERSION=" + mVersion;
|
QString url = getDescribeCoverageUrl( coverage->identifier );
|
||||||
|
|
||||||
if ( mVersion.startsWith( "1.0" ) )
|
|
||||||
{
|
|
||||||
url += "&COVERAGE=" + coverage->identifier;
|
|
||||||
}
|
|
||||||
else if ( mVersion.startsWith( "1.1" ) )
|
|
||||||
{
|
|
||||||
// in 1.1.0, 1.1.1, 1.1.2 the name of param is 'identifier'
|
|
||||||
// but in KVP 'identifiers'
|
|
||||||
url += "&IDENTIFIERS=" + coverage->identifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! sendRequest( url ) ) { return false; }
|
if ( ! sendRequest( url ) ) { return false; }
|
||||||
|
|
||||||
|
@ -125,8 +125,17 @@ class QgsWcsCapabilities : public QObject
|
|||||||
*/
|
*/
|
||||||
static QString prepareUri( QString uri );
|
static QString prepareUri( QString uri );
|
||||||
|
|
||||||
/**Returns the GetCoverage url
|
/** \brief Returns the GetCoverage full url
|
||||||
*/
|
* \param version optional version, e.g. 1.0.0 or 1.1.0 */
|
||||||
|
QString getCapabilitiesUrl( const QString version ) const;
|
||||||
|
|
||||||
|
/** \brief Returns the GetCoverage full url using current version */
|
||||||
|
QString getCapabilitiesUrl() const;
|
||||||
|
|
||||||
|
/** \brief Returns the GetCoverage full full url using current version */
|
||||||
|
QString getDescribeCoverageUrl( QString const &identifier ) const;
|
||||||
|
|
||||||
|
/** Returns the GetCoverage base url */
|
||||||
QString getCoverageUrl() const;
|
QString getCoverageUrl() const;
|
||||||
|
|
||||||
//! Send request to server
|
//! Send request to server
|
||||||
@ -225,7 +234,7 @@ class QgsWcsCapabilities : public QObject
|
|||||||
/**
|
/**
|
||||||
* \brief Retrieve and parse the (cached) Capabilities document from the server
|
* \brief Retrieve and parse the (cached) Capabilities document from the server
|
||||||
*
|
*
|
||||||
* \param preferredVersion - optional version KVP
|
* \param preferredVersion - optional version, e.g. 1.0.0, 1.1.0
|
||||||
*
|
*
|
||||||
* \retval false if the capabilities document could not be retrieved or parsed -
|
* \retval false if the capabilities document could not be retrieved or parsed -
|
||||||
* see lastError() for more info
|
* see lastError() for more info
|
||||||
|
@ -96,6 +96,7 @@ IF(UNIX AND NOT ANDROID AND CMAKE_BUILD_TYPE MATCHES Debug)
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/core
|
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/core
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/core/raster
|
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/core/raster
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/providers/wcs
|
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/providers/wcs
|
||||||
|
${QT_QTSCRIPT_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(qgis_wcstest
|
TARGET_LINK_LIBRARIES(qgis_wcstest
|
||||||
@ -105,6 +106,7 @@ IF(UNIX AND NOT ANDROID AND CMAKE_BUILD_TYPE MATCHES Debug)
|
|||||||
${QT_QTXML_LIBRARY}
|
${QT_QTXML_LIBRARY}
|
||||||
${QT_QTWEBKIT_LIBRARY}
|
${QT_QTWEBKIT_LIBRARY}
|
||||||
${QT_QTMAIN_LIBRARY}
|
${QT_QTMAIN_LIBRARY}
|
||||||
|
${QT_QTSCRIPT_LIBRARY}
|
||||||
qgis_core
|
qgis_core
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -112,5 +114,6 @@ IF(UNIX AND NOT ANDROID AND CMAKE_BUILD_TYPE MATCHES Debug)
|
|||||||
BUNDLE DESTINATION ${QGIS_BIN_DIR}
|
BUNDLE DESTINATION ${QGIS_BIN_DIR}
|
||||||
RUNTIME DESTINATION ${QGIS_BIN_DIR}
|
RUNTIME DESTINATION ${QGIS_BIN_DIR}
|
||||||
)
|
)
|
||||||
|
INSTALL(FILES wcs-servers.json DESTINATION ${QGIS_DATA_DIR}/resources)
|
||||||
|
|
||||||
ENDIF(UNIX AND NOT ANDROID AND CMAKE_BUILD_TYPE MATCHES Debug)
|
ENDIF(UNIX AND NOT ANDROID AND CMAKE_BUILD_TYPE MATCHES Debug)
|
||||||
|
@ -21,6 +21,9 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
#include <QScriptEngine>
|
||||||
|
#include <QScriptValue>
|
||||||
|
#include <QScriptValueIterator>
|
||||||
|
|
||||||
#include <qgsapplication.h>
|
#include <qgsapplication.h>
|
||||||
#include <qgsdatasourceuri.h>
|
#include <qgsdatasourceuri.h>
|
||||||
@ -46,11 +49,12 @@ int _fmode = _O_BINARY;
|
|||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TestQgsWcsPublicServers::TestQgsWcsPublicServers( const QString & cacheDirPath, int maxCoverages, const QString & server, const QString & coverage, bool force ):
|
TestQgsWcsPublicServers::TestQgsWcsPublicServers( const QString & cacheDirPath, int maxCoverages, const QString & server, const QString & coverage, const QString &version, bool force ):
|
||||||
mCacheDirPath( cacheDirPath )
|
mCacheDirPath( cacheDirPath )
|
||||||
, mMaxCoverages( maxCoverages )
|
, mMaxCoverages( maxCoverages )
|
||||||
, mServer( server )
|
, mServer( server )
|
||||||
, mCoverage( coverage )
|
, mCoverage( coverage )
|
||||||
|
, mVersion( version )
|
||||||
, mForce( force )
|
, mForce( force )
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -83,56 +87,123 @@ void TestQgsWcsPublicServers::init()
|
|||||||
mHead << "Values";
|
mHead << "Values";
|
||||||
mHead << "Colors";
|
mHead << "Colors";
|
||||||
mHead << "Has size";
|
mHead << "Has size";
|
||||||
|
|
||||||
|
// read servers + issues list
|
||||||
|
QString path = QgsApplication::pkgDataPath() + "/resources/wcs-servers.json";
|
||||||
|
QFile file( path );
|
||||||
|
if ( file.open( QIODevice::ReadOnly | QIODevice::Text ) )
|
||||||
|
{
|
||||||
|
QString data = file.readAll();
|
||||||
|
//QgsDebugMsg("servers: \n" + str );
|
||||||
|
file.close();
|
||||||
|
QScriptEngine engine;
|
||||||
|
QScriptValue result = engine.evaluate( data );
|
||||||
|
|
||||||
|
QScriptValueIterator serverIt( result );
|
||||||
|
while ( serverIt.hasNext() )
|
||||||
|
{
|
||||||
|
serverIt.next();
|
||||||
|
QScriptValue serverValue = serverIt.value();
|
||||||
|
|
||||||
|
QString serverUrl = serverValue.property( "url" ).toString();
|
||||||
|
QgsDebugMsg( "serverUrl: " + serverUrl );
|
||||||
|
|
||||||
|
Server server( serverUrl );
|
||||||
|
|
||||||
|
QScriptValue issuesValue = serverValue.property( "issues" );
|
||||||
|
|
||||||
|
QScriptValueIterator issuesIt( issuesValue );
|
||||||
|
while ( issuesIt.hasNext() )
|
||||||
|
{
|
||||||
|
issuesIt.next();
|
||||||
|
QScriptValue issueValue = issuesIt.value();
|
||||||
|
|
||||||
|
QString description = issueValue.property( "description" ).toString();
|
||||||
|
QgsDebugMsg( "description: " + description );
|
||||||
|
Issue issue( description );
|
||||||
|
|
||||||
|
QScriptValue coveragesValue = issueValue.property( "coverages" );
|
||||||
|
QScriptValueIterator coveragesIt( coveragesValue );
|
||||||
|
while ( coveragesIt.hasNext() )
|
||||||
|
{
|
||||||
|
coveragesIt.next();
|
||||||
|
issue.coverages << coveragesIt.value().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
QScriptValue versionsValue = issueValue.property( "versions" );
|
||||||
|
QScriptValueIterator versionsIt( versionsValue );
|
||||||
|
while ( versionsIt.hasNext() )
|
||||||
|
{
|
||||||
|
versionsIt.next();
|
||||||
|
issue.versions << versionsIt.value().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
server.issues << issue;
|
||||||
|
}
|
||||||
|
|
||||||
|
mServers << server;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QgsDebugMsg( "Cannot open " + path );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList TestQgsWcsPublicServers::issueDescriptions( const QString & url, const QString & coverage, const QString &version )
|
||||||
|
{
|
||||||
|
QStringList descriptions;
|
||||||
|
foreach ( Server server, mServers )
|
||||||
|
{
|
||||||
|
if ( server.url == url )
|
||||||
|
{
|
||||||
|
foreach ( Issue issue, server.issues )
|
||||||
|
{
|
||||||
|
if (( issue.coverages.size() == 0 || issue.coverages.contains( coverage ) ) &&
|
||||||
|
( issue.versions.size() == 0 || issue.versions.contains( version ) ) )
|
||||||
|
{
|
||||||
|
descriptions << issue.description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return descriptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestQgsWcsPublicServers::test( )
|
void TestQgsWcsPublicServers::test( )
|
||||||
{
|
{
|
||||||
QStringList versions;
|
QStringList versions;
|
||||||
// It may happen that server supports 1.1.1, but does not accept 1.1 (http://zeus.pin.unifi.it/gi-wcs/http)
|
QStringList serverUrls;
|
||||||
versions << "" << "1.0.0" << "1.1.0"; // empty for default
|
|
||||||
|
|
||||||
if ( !mServer.isEmpty() )
|
// It may happen that server supports 1.1.1, but does not accept 1.1 (http://zeus.pin.unifi.it/gi-wcs/http)
|
||||||
|
|
||||||
|
if ( !mVersion.isEmpty() )
|
||||||
{
|
{
|
||||||
Server server( mServer );
|
versions << mVersion;
|
||||||
mServers << server;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Some (first) coverages do not advertize any supportedCRS and sever gives
|
versions << "" << "1.0.0" << "1.1.0"; // empty for default
|
||||||
// error both with native CRS (EPSG::561005) and EPSG:4326
|
|
||||||
// MOD* coverages work OK
|
|
||||||
mServers << Server( "http://argon.geogr.uni-jena.de:8080/geoserver/ows" );
|
|
||||||
mServers << Server( "http://demo.geonode.org/geoserver/wcs" );
|
|
||||||
mServers << Server( "http://demo.mapserver.org/cgi-bin/wcs" );
|
|
||||||
mServers << Server( "http://demo.opengeo.org/geoserver/wcs" );
|
|
||||||
// geobrain.laits.gmu.edu servers are quite slow
|
|
||||||
mServers << Server( "http://geobrain.laits.gmu.edu/cgi-bin/gbwcs-dem" );
|
|
||||||
//mServers << Server ( "http://geobrain.laits.gmu.edu/cgi-bin/ows8/wcseo" );
|
|
||||||
//mServers << Server ( "http://geobrain.laits.gmu.edu/cgi-bin/wcs110" );
|
|
||||||
//mServers << Server ( "http://geobrain.laits.gmu.edu/cgi-bin/wcs-all" );
|
|
||||||
//mServers << Server ( "http://ws.csiss.gmu.edu/cgi-bin/wcs-t" );
|
|
||||||
// Big and slow
|
|
||||||
//mServers << Server ( "http://ws.laits.gmu.edu/cgi-bin/wcs-all" );
|
|
||||||
// Slow
|
|
||||||
//mServers << Server ( "http://iceds.ge.ucl.ac.uk/cgi-bin/icedswcs" );
|
|
||||||
mServers << Server( "http://motherlode.ucar.edu:8080/thredds/wcs/fmrc/NCEP/DGEX/Alaska_12km/NCEP-DGEX-Alaska_12km_best.ncd" );
|
|
||||||
mServers << Server( "http://navigator.state.or.us/ArcGIS/services/Framework/Imagery_Mosaic2009/ImageServer/WCSServer" );
|
|
||||||
mServers << Server( "http://nsidc.org/cgi-bin/atlas_north" );
|
|
||||||
// Slow
|
|
||||||
//mServers << Server ( "http://sedac.ciesin.columbia.edu/geoserver/wcs" );
|
|
||||||
// Big and slow
|
|
||||||
//mServers << Server ( "http://webmap.ornl.gov/ogcbroker/wcs" );
|
|
||||||
// Currently very slow or down
|
|
||||||
//mServers << Server ( "http://www.sogeo.ch/geoserver/wcs" );
|
|
||||||
// Slow and erroneous
|
|
||||||
//mServers << Server ( "http://zeus.pin.unifi.it/gi-wcs/http" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( Server server, mServers )
|
|
||||||
|
if ( !mServer.isEmpty() )
|
||||||
|
{
|
||||||
|
serverUrls << mServer;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach ( Server server, mServers )
|
||||||
|
{
|
||||||
|
serverUrls << server.url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( QString serverUrl, serverUrls )
|
||||||
{
|
{
|
||||||
QStringList myServerLog;
|
QStringList myServerLog;
|
||||||
myServerLog << "server:" + server.url;
|
myServerLog << "server:" + serverUrl;
|
||||||
QString myServerDirName = server.url;
|
QString myServerDirName = serverUrl;
|
||||||
myServerDirName.replace( QRegExp( "[:/]+" ), "." );
|
myServerDirName.replace( QRegExp( "[:/]+" ), "." );
|
||||||
myServerDirName.replace( QRegExp( "\\.$" ), "" );
|
myServerDirName.replace( QRegExp( "\\.$" ), "" );
|
||||||
QgsDebugMsg( "myServerDirName = " + myServerDirName );
|
QgsDebugMsg( "myServerDirName = " + myServerDirName );
|
||||||
@ -148,7 +219,7 @@ void TestQgsWcsPublicServers::test( )
|
|||||||
|
|
||||||
foreach ( QString version, versions )
|
foreach ( QString version, versions )
|
||||||
{
|
{
|
||||||
QgsDebugMsg( "server: " + server.url + " version: " + version );
|
QgsDebugMsg( "server: " + serverUrl + " version: " + version );
|
||||||
QStringList myVersionLog;
|
QStringList myVersionLog;
|
||||||
myVersionLog << "version:" + version;
|
myVersionLog << "version:" + version;
|
||||||
|
|
||||||
@ -165,7 +236,7 @@ void TestQgsWcsPublicServers::test( )
|
|||||||
|
|
||||||
QgsDataSourceURI myServerUri;
|
QgsDataSourceURI myServerUri;
|
||||||
|
|
||||||
myServerUri.setParam( "url", server.url );
|
myServerUri.setParam( "url", serverUrl );
|
||||||
if ( !version.isEmpty() )
|
if ( !version.isEmpty() )
|
||||||
{
|
{
|
||||||
myServerUri.setParam( "version", version );
|
myServerUri.setParam( "version", version );
|
||||||
@ -174,6 +245,7 @@ void TestQgsWcsPublicServers::test( )
|
|||||||
QgsWcsCapabilities myCapabilities;
|
QgsWcsCapabilities myCapabilities;
|
||||||
myCapabilities.setUri( myServerUri );
|
myCapabilities.setUri( myServerUri );
|
||||||
|
|
||||||
|
|
||||||
if ( !myCapabilities.lastError().isEmpty() )
|
if ( !myCapabilities.lastError().isEmpty() )
|
||||||
{
|
{
|
||||||
QgsDebugMsg( myCapabilities.lastError() );
|
QgsDebugMsg( myCapabilities.lastError() );
|
||||||
@ -181,6 +253,8 @@ void TestQgsWcsPublicServers::test( )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
myVersionLog << "getCapabilitiesUrl:" + myCapabilities.getCapabilitiesUrl();
|
||||||
|
|
||||||
QVector<QgsWcsCoverageSummary> myCoverages;
|
QVector<QgsWcsCoverageSummary> myCoverages;
|
||||||
if ( !myCapabilities.supportedCoverages( myCoverages ) )
|
if ( !myCapabilities.supportedCoverages( myCoverages ) )
|
||||||
{
|
{
|
||||||
@ -238,7 +312,7 @@ void TestQgsWcsPublicServers::test( )
|
|||||||
myUri.setParam( "time", myCoverage.times.value( 0 ) );
|
myUri.setParam( "time", myCoverage.times.value( 0 ) );
|
||||||
}
|
}
|
||||||
myLog << "version:" + version;
|
myLog << "version:" + version;
|
||||||
myLog << "uri:" + myUri.encodedUri();
|
myLog << "describeCoverageUrl:" + myCapabilities.getDescribeCoverageUrl( myCoverage.identifier );
|
||||||
// Test time
|
// Test time
|
||||||
//myLog << "date:" + QString( "%1").arg( QDateTime::currentDateTime().toTime_t() );
|
//myLog << "date:" + QString( "%1").arg( QDateTime::currentDateTime().toTime_t() );
|
||||||
myLog << "date:" + QString( "%1" ).arg( QDateTime::currentDateTime().toString() );
|
myLog << "date:" + QString( "%1" ).arg( QDateTime::currentDateTime().toString() );
|
||||||
@ -405,7 +479,7 @@ void TestQgsWcsPublicServers::report()
|
|||||||
QDir myVersionDir( myVersionDirPath );
|
QDir myVersionDir( myVersionDirPath );
|
||||||
|
|
||||||
QString myVersion = myVersionLog.value( "version" );
|
QString myVersion = myVersionLog.value( "version" );
|
||||||
myServerReport += QString( "<h3>Version: %1</h3>" ).arg( myVersion.isEmpty() ? "(empty)" : myVersion );
|
myServerReport += QString( "<h3><a href='%1'>Version: %2</a></h3>" ).arg( myVersionLog.value( "getCapabilitiesUrl" ) ).arg( myVersion.isEmpty() ? "(empty)" : myVersion );
|
||||||
|
|
||||||
if ( !myVersionLog.value( "error" ).isEmpty() )
|
if ( !myVersionLog.value( "error" ).isEmpty() )
|
||||||
{
|
{
|
||||||
@ -433,13 +507,15 @@ void TestQgsWcsPublicServers::report()
|
|||||||
QString myLogPath = myVersionDir.absolutePath() + QDir::separator() + myLogFileName;
|
QString myLogPath = myVersionDir.absolutePath() + QDir::separator() + myLogFileName;
|
||||||
QMap<QString, QString>myLog = readLog( myLogPath );
|
QMap<QString, QString>myLog = readLog( myLogPath );
|
||||||
QStringList myValues;
|
QStringList myValues;
|
||||||
myValues << myLog.value( "identifier" );
|
myValues << QString( "<a href='%1'>%2</a>" ).arg( myLog.value( "describeCoverageUrl" ) ).arg( myLog.value( "identifier" ) );
|
||||||
myValues << myLog.value( "version" );
|
myValues << myLog.value( "version" );
|
||||||
QString imgPath = myVersionDir.absolutePath() + QDir::separator() + QFileInfo( myLogPath ).completeBaseName() + ".png";
|
QString imgPath = myVersionDir.absolutePath() + QDir::separator() + QFileInfo( myLogPath ).completeBaseName() + ".png";
|
||||||
|
|
||||||
if ( !myLog.value( "error" ).isEmpty() )
|
if ( !myLog.value( "error" ).isEmpty() )
|
||||||
{
|
{
|
||||||
myValues << myLog.value( "error" );
|
myValues << myLog.value( "error" );
|
||||||
|
QStringList issues = issueDescriptions( myServerLog.value( "server" ), myLog.value( "identifier" ), myLog.value( "version" ) );
|
||||||
|
myValues << issues.join( "<br>" );
|
||||||
myVersionReport += row( myValues, "cellerr" );
|
myVersionReport += row( myValues, "cellerr" );
|
||||||
myVersionErrCount++;
|
myVersionErrCount++;
|
||||||
}
|
}
|
||||||
@ -473,10 +549,10 @@ void TestQgsWcsPublicServers::report()
|
|||||||
myVersionReport += row( myValues, cls );
|
myVersionReport += row( myValues, cls );
|
||||||
}
|
}
|
||||||
} // coverages
|
} // coverages
|
||||||
myVersionReport += "</table>";
|
myVersionReport += "</table>\n";
|
||||||
// prepend counts
|
// prepend counts
|
||||||
myVersionReport.prepend( QString( "<b>Coverages: %1</b><br>" ).arg( myVersionCoverageCount ) +
|
myVersionReport.prepend( QString( "<b>Coverages: %1</b><br>\n" ).arg( myVersionCoverageCount ) +
|
||||||
QString( "<b>Errors: %1</b><br>" ).arg( myVersionErrCount ) +
|
QString( "<b>Errors: %1</b><br>\n" ).arg( myVersionErrCount ) +
|
||||||
QString( "<b>Warnings: %1</b><br><br>" ).arg( myVersionWarnCount ) );
|
QString( "<b>Warnings: %1</b><br><br>" ).arg( myVersionWarnCount ) );
|
||||||
myServerReport += myVersionReport;
|
myServerReport += myVersionReport;
|
||||||
}
|
}
|
||||||
@ -504,12 +580,12 @@ void TestQgsWcsPublicServers::report()
|
|||||||
myRep += "</style>";
|
myRep += "</style>";
|
||||||
|
|
||||||
myRep += QString( "<p>Tested first %1 coverages for each server/version</p>" ).arg( mMaxCoverages );
|
myRep += QString( "<p>Tested first %1 coverages for each server/version</p>" ).arg( mMaxCoverages );
|
||||||
myRep += QString( "<b>Servers: %1</b><br>" ).arg( myServerCount );
|
myRep += QString( "<b>Servers: %1</b><br>\n" ).arg( myServerCount );
|
||||||
myRep += QString( "<b>Servers with error: %1</b><br>" ).arg( myServerErrCount );
|
myRep += QString( "<b>Servers with error: %1</b><br>\n" ).arg( myServerErrCount );
|
||||||
myRep += QString( "<b>Servers with warning: %1</b><br>" ).arg( myServerWarnCount );
|
myRep += QString( "<b>Servers with warning: %1</b><br>\n" ).arg( myServerWarnCount );
|
||||||
myRep += QString( "<b>Coverages: %1</b><br>" ).arg( myCoverageCount );
|
myRep += QString( "<b>Coverages: %1</b><br>\n" ).arg( myCoverageCount );
|
||||||
myRep += QString( "<b>Coverage errors: %1</b><br>" ).arg( myCoverageErrCount );
|
myRep += QString( "<b>Coverage errors: %1</b><br>\n" ).arg( myCoverageErrCount );
|
||||||
myRep += QString( "<b>Coverage warnings: %1</b><br>" ).arg( myCoverageWarnCount );
|
myRep += QString( "<b>Coverage warnings: %1</b><br>\n" ).arg( myCoverageWarnCount );
|
||||||
|
|
||||||
myRep += myReport;
|
myRep += myReport;
|
||||||
|
|
||||||
@ -555,7 +631,7 @@ QString TestQgsWcsPublicServers::row( QStringList theValues, QString theClass )
|
|||||||
}
|
}
|
||||||
myRow += QString( "<td class='cell %1' %2>%3</td>" ).arg( theClass ).arg( colspan ).arg( val );
|
myRow += QString( "<td class='cell %1' %2>%3</td>" ).arg( theClass ).arg( colspan ).arg( val );
|
||||||
}
|
}
|
||||||
myRow += "</tr>";
|
myRow += "</tr>\n";
|
||||||
return myRow;
|
return myRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -566,9 +642,11 @@ void usage( std::string const & appName )
|
|||||||
<< "Console application for QGIS WCS provider (WCS client) testing.\n"
|
<< "Console application for QGIS WCS provider (WCS client) testing.\n"
|
||||||
<< "Usage: " << appName << " [options] CACHE_DIR\n"
|
<< "Usage: " << appName << " [options] CACHE_DIR\n"
|
||||||
<< " options: \n"
|
<< " options: \n"
|
||||||
<< "\t[--server URL]\tWCS server URL to be tested\n"
|
<< "\t[--server URL]\tWCS server URL to be tested.\n"
|
||||||
<< "\t[--coverage coverage]\tCoverage name to be tested\n"
|
<< "\t[--coverage coverage]\tCoverage name to be tested.\n"
|
||||||
<< "\t[--num count]\tMaximum number of coverages to test per server. Default 2.\n"
|
<< "\t[--num count]\tMaximum number of coverages to test per server. Default 2.\n"
|
||||||
|
<< "\t[--version version]\tWCS version to be tested.\n"
|
||||||
|
<< "\t[--force]\tForce retrieve, overwrite cache.\n"
|
||||||
<< " FILES:\n"
|
<< " FILES:\n"
|
||||||
<< " Path to directory where cached results are stored.\n"
|
<< " Path to directory where cached results are stored.\n"
|
||||||
<< " Coverage once retrieved (success or fail) is not requested again until the cache is deleted.\n";
|
<< " Coverage once retrieved (success or fail) is not requested again until the cache is deleted.\n";
|
||||||
@ -586,6 +664,7 @@ int main( int argc, char *argv[] )
|
|||||||
|
|
||||||
QString myServer;
|
QString myServer;
|
||||||
QString myCoverage;
|
QString myCoverage;
|
||||||
|
QString myVersion;
|
||||||
int myMaxCoverages = 2;
|
int myMaxCoverages = 2;
|
||||||
bool myForce;
|
bool myForce;
|
||||||
|
|
||||||
@ -597,6 +676,7 @@ int main( int argc, char *argv[] )
|
|||||||
{"server", required_argument, 0, 's'},
|
{"server", required_argument, 0, 's'},
|
||||||
{"coverage", required_argument, 0, 'c'},
|
{"coverage", required_argument, 0, 'c'},
|
||||||
{"num", required_argument, 0, 'n'},
|
{"num", required_argument, 0, 'n'},
|
||||||
|
{"version", required_argument, 0, 'v'},
|
||||||
{"force", no_argument, 0, 'f'},
|
{"force", no_argument, 0, 'f'},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
@ -606,7 +686,7 @@ int main( int argc, char *argv[] )
|
|||||||
/* getopt_long stores the option index here. */
|
/* getopt_long stores the option index here. */
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
|
|
||||||
optionChar = getopt_long( argc, argv, "hscnf",
|
optionChar = getopt_long( argc, argv, "hscnvf",
|
||||||
long_options, &option_index );
|
long_options, &option_index );
|
||||||
|
|
||||||
/* Detect the end of the options. */
|
/* Detect the end of the options. */
|
||||||
@ -637,6 +717,10 @@ int main( int argc, char *argv[] )
|
|||||||
myMaxCoverages = QString( optarg ).toInt();
|
myMaxCoverages = QString( optarg ).toInt();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'v':
|
||||||
|
myVersion = QString( optarg );
|
||||||
|
break;
|
||||||
|
|
||||||
case 'f':
|
case 'f':
|
||||||
myForce = true;
|
myForce = true;
|
||||||
break;
|
break;
|
||||||
@ -656,6 +740,7 @@ int main( int argc, char *argv[] )
|
|||||||
QgsDebugMsg( QString( "myServer = %1" ).arg( myServer ) );
|
QgsDebugMsg( QString( "myServer = %1" ).arg( myServer ) );
|
||||||
QgsDebugMsg( QString( "myCoverage = %1" ).arg( myCoverage ) );
|
QgsDebugMsg( QString( "myCoverage = %1" ).arg( myCoverage ) );
|
||||||
QgsDebugMsg( QString( "myMaxCoverages = %1" ).arg( myMaxCoverages ) );
|
QgsDebugMsg( QString( "myMaxCoverages = %1" ).arg( myMaxCoverages ) );
|
||||||
|
QgsDebugMsg( QString( "myVersion = %1" ).arg( myVersion ) );
|
||||||
|
|
||||||
if ( !myCoverage.isEmpty() && myServer.isEmpty() )
|
if ( !myCoverage.isEmpty() && myServer.isEmpty() )
|
||||||
{
|
{
|
||||||
@ -691,7 +776,7 @@ int main( int argc, char *argv[] )
|
|||||||
QgsApplication::init( QString() );
|
QgsApplication::init( QString() );
|
||||||
QgsApplication::initQgis();
|
QgsApplication::initQgis();
|
||||||
|
|
||||||
TestQgsWcsPublicServers myTest( myCacheDirPath, myMaxCoverages, myServer, myCoverage, myForce );
|
TestQgsWcsPublicServers myTest( myCacheDirPath, myMaxCoverages, myServer, myCoverage, myVersion, myForce );
|
||||||
myTest.init();
|
myTest.init();
|
||||||
myTest.test();
|
myTest.test();
|
||||||
myTest.report();
|
myTest.report();
|
||||||
|
@ -38,6 +38,7 @@ class TestQgsWcsPublicServers: public QObject
|
|||||||
QStringList versions; // version regex
|
QStringList versions; // version regex
|
||||||
QStringList coverages; // coverage regex
|
QStringList coverages; // coverage regex
|
||||||
QString description; // problem description
|
QString description; // problem description
|
||||||
|
Issue( const QString & d ) : description( d ) {}
|
||||||
};
|
};
|
||||||
struct Server
|
struct Server
|
||||||
{
|
{
|
||||||
@ -48,7 +49,7 @@ class TestQgsWcsPublicServers: public QObject
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
TestQgsWcsPublicServers( const QString & cacheDirPath, int maxCoverages, const QString & server = QString(), const QString & coverage = QString(), bool force = false );
|
TestQgsWcsPublicServers( const QString & cacheDirPath, int maxCoverages, const QString & server = QString(), const QString & coverage = QString(), const QString &version = QString(), bool force = false );
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
void test();
|
void test();
|
||||||
@ -60,6 +61,8 @@ class TestQgsWcsPublicServers: public QObject
|
|||||||
|
|
||||||
QMap<QString, QString> readLog( QString theFileName );
|
QMap<QString, QString> readLog( QString theFileName );
|
||||||
|
|
||||||
|
QStringList issueDescriptions( const QString & url, const QString & coverage, const QString &version );
|
||||||
|
|
||||||
QString mCacheDirPath;
|
QString mCacheDirPath;
|
||||||
QDir mCacheDir;
|
QDir mCacheDir;
|
||||||
|
|
||||||
@ -68,6 +71,7 @@ class TestQgsWcsPublicServers: public QObject
|
|||||||
|
|
||||||
QString mServer;
|
QString mServer;
|
||||||
QString mCoverage;
|
QString mCoverage;
|
||||||
|
QString mVersion;
|
||||||
|
|
||||||
// Force cached
|
// Force cached
|
||||||
bool mForce;
|
bool mForce;
|
||||||
|
59
tests/src/providers/wcs-servers.json
Normal file
59
tests/src/providers/wcs-servers.json
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
url: 'http://demo.opengeo.org/geoserver/wcs',
|
||||||
|
issues: [
|
||||||
|
{
|
||||||
|
coverages: [ 'og:0' ],
|
||||||
|
versions: [ ],
|
||||||
|
description: 'Server fails on DescribeCoverage with: java.io.IOException null Translator error Unexpected error occurred during describe coverage xml encoding ...'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
url: 'http://demo.geonode.org/geoserver/wcs'
|
||||||
|
}, {
|
||||||
|
url: 'http://demo.mapserver.org/cgi-bin/wcs'
|
||||||
|
}, {
|
||||||
|
// Some (first) coverages do not advertise any supportedCRS and sever gives
|
||||||
|
// error both with native CRS (EPSG::561005) and EPSG:4326
|
||||||
|
// MOD* coverages work OK
|
||||||
|
url: 'http://argon.geogr.uni-jena.de:8080/geoserver/ows'
|
||||||
|
}, {
|
||||||
|
// geobrain.laits.gmu.edu servers are quite slow
|
||||||
|
url: 'http://geobrain.laits.gmu.edu/cgi-bin/gbwcs-dem'
|
||||||
|
/*
|
||||||
|
}, {
|
||||||
|
url: 'http://geobrain.laits.gmu.edu/cgi-bin/ows8/wcseo'
|
||||||
|
}, {
|
||||||
|
url: 'http://geobrain.laits.gmu.edu/cgi-bin/wcs110'
|
||||||
|
}, {
|
||||||
|
url: 'http://geobrain.laits.gmu.edu/cgi-bin/wcs-all'
|
||||||
|
}, {
|
||||||
|
url: 'http://ws.csiss.gmu.edu/cgi-bin/wcs-t'
|
||||||
|
}, {
|
||||||
|
// Big and slow
|
||||||
|
url: 'http://ws.laits.gmu.edu/cgi-bin/wcs-all'
|
||||||
|
}, {
|
||||||
|
// Slow
|
||||||
|
url: 'http://iceds.ge.ucl.ac.uk/cgi-bin/icedswcs'
|
||||||
|
*/
|
||||||
|
}, {
|
||||||
|
url: 'http://motherlode.ucar.edu:8080/thredds/wcs/fmrc/NCEP/DGEX/Alaska_12km/NCEP-DGEX-Alaska_12km_best.ncd'
|
||||||
|
}, {
|
||||||
|
url: 'http://navigator.state.or.us/ArcGIS/services/Framework/Imagery_Mosaic2009/ImageServer/WCSServer'
|
||||||
|
}, {
|
||||||
|
url: 'http://nsidc.org/cgi-bin/atlas_north'
|
||||||
|
/*
|
||||||
|
}, {
|
||||||
|
// Slow
|
||||||
|
url: 'http://sedac.ciesin.columbia.edu/geoserver/wcs'
|
||||||
|
}, {
|
||||||
|
// Big and slow
|
||||||
|
url: 'http://webmap.ornl.gov/ogcbroker/wcs'
|
||||||
|
}, {
|
||||||
|
// Currently very slow or down
|
||||||
|
url: 'http://www.sogeo.ch/geoserver/wcs'
|
||||||
|
}, {
|
||||||
|
url: 'http://zeus.pin.unifi.it/gi-wcs/http'
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
]
|
Loading…
x
Reference in New Issue
Block a user