|
25 | 25 | #include "qgscoordinatetransform.h"
|
26 | 26 | #include "qgsdataitem.h"
|
27 | 27 | #include "qgsdatasourceuri.h"
|
| 28 | +#include "qgsmessagelog.h" |
28 | 29 | #include "qgsrectangle.h"
|
29 | 30 | #include "qgscoordinatereferencesystem.h"
|
30 | 31 | #include "qgsrasterbandstats.h"
|
@@ -116,21 +117,32 @@ QgsGdalProvider::QgsGdalProvider( QString const & uri )
|
116 | 117 | // We cannot use 1.1.0 because of wrong longlat bbox send by GDAL
|
117 | 118 | // and impossibility to set GridOffsets.
|
118 | 119 |
|
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 |
129 | 140 |
|
130 | 141 | QgsDataSourceURI dsUri;
|
131 | 142 | dsUri.setEncodedUri( uri );
|
132 | 143 | gdalUri = "<WCS_GDAL>";
|
133 | 144 | gdalUri += "<Version>1.0.0</Version>";
|
| 145 | + //gdalUri += "<Version>1.1.0</Version>"; |
134 | 146 | // prepareUri adds ? or & if necessary, GDAL fails otherwise
|
135 | 147 | gdalUri += "<ServiceURL>" + Qt::escape( QgsWcsCapabilities::prepareUri( dsUri.param( "url" ) ) ) + "</ServiceURL>";
|
136 | 148 | gdalUri += "<CoverageName>" + dsUri.param( "identifier" ) + "</CoverageName>";
|
@@ -158,13 +170,15 @@ QgsGdalProvider::QgsGdalProvider( QString const & uri )
|
158 | 170 | QgsDebugMsg( "WCS uri: " + gdalUri );
|
159 | 171 | }
|
160 | 172 |
|
| 173 | + CPLErrorReset(); |
161 | 174 | //mGdalBaseDataset = GDALOpen( QFile::encodeName( uri ).constData(), GA_ReadOnly );
|
162 | 175 | mGdalBaseDataset = GDALOpen( TO8F( gdalUri ), GA_ReadOnly );
|
163 | 176 |
|
164 |
| - CPLErrorReset(); |
165 | 177 | if ( mGdalBaseDataset == NULL )
|
166 | 178 | {
|
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 ); |
168 | 182 | return;
|
169 | 183 | }
|
170 | 184 |
|
|
0 commit comments