Skip to content

Commit 3cb4669

Browse files
committed
WCS extent and save as fix
1 parent e8061c7 commit 3cb4669

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/gui/qgsrasterlayersaveasdialog.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,10 @@ void QgsRasterLayerSaveAsDialog::setOutputExtent( const QgsRectangle& r, const Q
251251
extent = ct.transformBoundingBox( r );
252252
}
253253

254-
mXMinLineEdit->setText( QString::number( extent.xMinimum() ) );
255-
mXMaxLineEdit->setText( QString::number( extent.xMaximum() ) );
256-
mYMinLineEdit->setText( QString::number( extent.yMinimum() ) );
257-
mYMaxLineEdit->setText( QString::number( extent.yMaximum() ) );
254+
mXMinLineEdit->setText( QgsRasterInterface::printValue( extent.xMinimum() ) );
255+
mXMaxLineEdit->setText( QgsRasterInterface::printValue( extent.xMaximum() ) );
256+
mYMinLineEdit->setText( QgsRasterInterface::printValue( extent.yMinimum() ) );
257+
mYMaxLineEdit->setText( QgsRasterInterface::printValue( extent.yMaximum() ) );
258258

259259
mExtentState = state;
260260
extentChanged();

src/providers/wcs/qgswcscapabilities.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,7 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom10( QByteArray const &xml, QgsW
762762
QList<int> high = parseInts( domElementText( gridElement, "limits.GridEnvelope.high" ) );
763763
if ( low.size() == 2 && high.size() == 2 )
764764
{
765+
// low/high are indexes in grid -> size is hight - low + 1
765766
double width = high[0] - low[0] + 1;
766767
double height = high[1] - low[1] + 1;
767768
if ( width > 0 && height > 0 )

src/providers/wcs/qgswcsprovider.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,14 @@ QgsWcsProvider::QgsWcsProvider( QString const &uri )
171171
// in that case we continue without CRS and user is asked for it
172172
//if ( mCoverageCrs.isEmpty() ) return;
173173

174+
// Native size
174175
mWidth = mCoverageSummary.width;
175176
mHeight = mCoverageSummary.height;
176177
mHasSize = mCoverageSummary.hasSize;
177178

178-
QgsDebugMsg( QString( "mWidth = %1 mHeight = %2" ).arg( mWidth ).arg( mHeight ) ) ;
179+
QgsDebugMsg( QString( "mWidth = %1 mHeight = %2" ).arg( mWidth ).arg( mHeight ) );
180+
181+
// TODO: Consider if/how to recalculate mWidth, mHeight if non native CRS is used
179182

180183
if ( !calculateExtent() )
181184
{
@@ -1288,7 +1291,8 @@ bool QgsWcsProvider::calculateExtent()
12881291
// Prefer to use extent from capabilities / coverage description because
12891292
// transformation from WGS84 increases the extent
12901293
mCoverageExtent = mCoverageSummary.boundingBoxes.value( mCoverageCrs );
1291-
if ( !mCoverageExtent.isEmpty() && !mCoverageExtent.isFinite() )
1294+
QgsDebugMsg( "mCoverageCrs = " + mCoverageCrs + " mCoverageExtent = " + mCoverageExtent.toString() );
1295+
if ( !mCoverageExtent.isEmpty() && mCoverageExtent.isFinite() )
12921296
{
12931297
QgsDebugMsg( "mCoverageExtent = " + mCoverageExtent.toString() );
12941298
return true;
@@ -1308,9 +1312,11 @@ bool QgsWcsProvider::calculateExtent()
13081312
//QgsDebugMsg( "qgisSrsDest: " + qgisSrsDest.toWkt() );
13091313

13101314
mCoordinateTransform = new QgsCoordinateTransform( qgisSrsSource, qgisSrsDest );
1315+
13111316
}
13121317

13131318
QgsDebugMsg( "mCoverageSummary.wgs84BoundingBox= " + mCoverageSummary.wgs84BoundingBox.toString() );
1319+
13141320
// Convert to the user's CRS as required
13151321
try
13161322
{

0 commit comments

Comments
 (0)