Skip to content

Commit edfeba1

Browse files
committed
explanation of various bugs in GDAL and Mapserver
1 parent dce6b6c commit edfeba1

File tree

3 files changed

+34
-16
lines changed

3 files changed

+34
-16
lines changed

src/gui/qgsowssourceselect.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,12 @@ void QgsOWSSourceSelect::populateFormats()
165165
if ( firstVisible == -1 ) firstVisible = id;
166166
}
167167
// Set first if no one visible is checked
168-
if ( mImageFormatGroup->checkedId() < 0 || ( !mImageFormatGroup->button( mImageFormatGroup->checkedId() )->isVisible() && firstVisible > -1 ) )
168+
if ( mImageFormatGroup->checkedId() < 0 || !mImageFormatGroup->button( mImageFormatGroup->checkedId() )->isVisible() )
169169
{
170-
mImageFormatGroup->button( firstVisible )->setChecked( true );
170+
if ( firstVisible > -1 )
171+
{
172+
mImageFormatGroup->button( firstVisible )->setChecked( true );
173+
}
171174
}
172175

173176
mImageFormatsGroupBox->setEnabled( true );

src/providers/gdal/qgsgdalprovider.cpp

+26-12
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "qgscoordinatetransform.h"
2626
#include "qgsdataitem.h"
2727
#include "qgsdatasourceuri.h"
28+
#include "qgsmessagelog.h"
2829
#include "qgsrectangle.h"
2930
#include "qgscoordinatereferencesystem.h"
3031
#include "qgsrasterbandstats.h"
@@ -116,21 +117,32 @@ QgsGdalProvider::QgsGdalProvider( QString const & uri )
116117
// We cannot use 1.1.0 because of wrong longlat bbox send by GDAL
117118
// and impossibility to set GridOffsets.
118119

119-
// - WCS 1.0.0 does not work with GDAL r24316 2012-04-25 + Mapserver 6.0.2 with
120-
// geographic CRS
121-
// GDAL sends BOUNDINGBOX=min_long,min_lat,max_lon,max_lat,urn:ogc:def:crs:EPSG::4326
122-
// Mapserver works with min_lat,min_long,max_lon,max_lat
123-
// OGC 07-067r5 (WCS 1.1.2) referes to OGC 06-121r3 which says:
124-
// "The number of axes included, and the order of these axes, shall be as
125-
// specified by the referenced CRS."
126-
// EPSG defines for EPSG:4326 Axes: latitude, longitude
127-
// (don't confuse with OGC:CRS84 with lon,lat order)
128-
//
120+
// - WCS 1.0.0 does not work with GDAL r24316 2012-04-25 + Mapserver 6.0.2
121+
// 1) with geographic CRS
122+
// GDAL sends BOUNDINGBOX=min_long,min_lat,max_lon,max_lat,urn:ogc:def:crs:EPSG::4326
123+
// Mapserver works with min_lat,min_long,max_lon,max_lat
124+
// OGC 07-067r5 (WCS 1.1.2) referes to OGC 06-121r3 which says:
125+
// "The number of axes included, and the order of these axes, shall be as
126+
// specified by the referenced CRS."
127+
// EPSG defines for EPSG:4326 Axes: latitude, longitude
128+
// (don't confuse with OGC:CRS84 with lon,lat order)
129+
// Created a ticket: http://trac.osgeo.org/gdal/ticket/4639
130+
131+
// 2) Mapserver ignores RangeSubset (not implemented in mapserver)
132+
// and GDAL fails with "Returned tile does not match expected band count"
133+
// because it requested single band but recieved all bands
134+
// Created ticket: https://github.com/mapserver/mapserver/issues/4299
135+
136+
// Other problems:
137+
// - GDAL WCS fails to open 1.1 with space in RangeSubset, there is a ticket about
138+
// it http://trac.osgeo.org/gdal/ticket/1833 without conclusion, Frank suggests
139+
// that ServiceURL should be expected to be escaped while CoverageName should not
129140

130141
QgsDataSourceURI dsUri;
131142
dsUri.setEncodedUri( uri );
132143
gdalUri = "<WCS_GDAL>";
133144
gdalUri += "<Version>1.0.0</Version>";
145+
//gdalUri += "<Version>1.1.0</Version>";
134146
// prepareUri adds ? or & if necessary, GDAL fails otherwise
135147
gdalUri += "<ServiceURL>" + Qt::escape( QgsWcsCapabilities::prepareUri( dsUri.param( "url" ) ) ) + "</ServiceURL>";
136148
gdalUri += "<CoverageName>" + dsUri.param( "identifier" ) + "</CoverageName>";
@@ -158,13 +170,15 @@ QgsGdalProvider::QgsGdalProvider( QString const & uri )
158170
QgsDebugMsg( "WCS uri: " + gdalUri );
159171
}
160172

173+
CPLErrorReset();
161174
//mGdalBaseDataset = GDALOpen( QFile::encodeName( uri ).constData(), GA_ReadOnly );
162175
mGdalBaseDataset = GDALOpen( TO8F( gdalUri ), GA_ReadOnly );
163176

164-
CPLErrorReset();
165177
if ( mGdalBaseDataset == NULL )
166178
{
167-
QgsDebugMsg( QString( "Cannot open GDAL dataset %1: %2" ).arg( uri ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) );
179+
QString msg = QString( "Cannot open GDAL dataset %1:\n%2" ).arg( uri ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) );
180+
QgsDebugMsg( msg );
181+
QgsMessageLog::logMessage( msg );
168182
return;
169183
}
170184

src/providers/gdal/qgswcscapabilities.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,11 @@ bool QgsWcsCapabilities::parseCapabilitiesDom( QByteArray const &xml, QgsWcsCapa
316316
// Assert that the DTD is what we expected (i.e. a WCS Capabilities document)
317317
QgsDebugMsg( "testing tagName " + docElem.tagName() );
318318

319+
QString tagName = stripNS( docElem.tagName() );
319320
if (
320321
// We don't support 1.0, but try WCS_Capabilities tag to get version
321-
docElem.tagName() != "WCS_Capabilities" && // 1.0
322-
docElem.tagName() != "Capabilities" // 1.1
322+
tagName != "WCS_Capabilities" && // 1.0
323+
tagName != "Capabilities" // 1.1, tags seen: Capabilities, wcs:Capabilities
323324
)
324325
{
325326
mErrorTitle = tr( "Dom Exception" );

0 commit comments

Comments
 (0)