Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
WCS extent and save as fix
  • Loading branch information
blazek committed Sep 12, 2012
1 parent e8061c7 commit 3cb4669
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/gui/qgsrasterlayersaveasdialog.cpp
Expand Up @@ -251,10 +251,10 @@ void QgsRasterLayerSaveAsDialog::setOutputExtent( const QgsRectangle& r, const Q
extent = ct.transformBoundingBox( r );
}

mXMinLineEdit->setText( QString::number( extent.xMinimum() ) );
mXMaxLineEdit->setText( QString::number( extent.xMaximum() ) );
mYMinLineEdit->setText( QString::number( extent.yMinimum() ) );
mYMaxLineEdit->setText( QString::number( extent.yMaximum() ) );
mXMinLineEdit->setText( QgsRasterInterface::printValue( extent.xMinimum() ) );
mXMaxLineEdit->setText( QgsRasterInterface::printValue( extent.xMaximum() ) );
mYMinLineEdit->setText( QgsRasterInterface::printValue( extent.yMinimum() ) );
mYMaxLineEdit->setText( QgsRasterInterface::printValue( extent.yMaximum() ) );

mExtentState = state;
extentChanged();
Expand Down
1 change: 1 addition & 0 deletions src/providers/wcs/qgswcscapabilities.cpp
Expand Up @@ -762,6 +762,7 @@ bool QgsWcsCapabilities::parseDescribeCoverageDom10( QByteArray const &xml, QgsW
QList<int> high = parseInts( domElementText( gridElement, "limits.GridEnvelope.high" ) );
if ( low.size() == 2 && high.size() == 2 )
{
// low/high are indexes in grid -> size is hight - low + 1
double width = high[0] - low[0] + 1;
double height = high[1] - low[1] + 1;
if ( width > 0 && height > 0 )
Expand Down
10 changes: 8 additions & 2 deletions src/providers/wcs/qgswcsprovider.cpp
Expand Up @@ -171,11 +171,14 @@ QgsWcsProvider::QgsWcsProvider( QString const &uri )
// in that case we continue without CRS and user is asked for it
//if ( mCoverageCrs.isEmpty() ) return;

// Native size
mWidth = mCoverageSummary.width;
mHeight = mCoverageSummary.height;
mHasSize = mCoverageSummary.hasSize;

QgsDebugMsg( QString( "mWidth = %1 mHeight = %2" ).arg( mWidth ).arg( mHeight ) ) ;
QgsDebugMsg( QString( "mWidth = %1 mHeight = %2" ).arg( mWidth ).arg( mHeight ) );

// TODO: Consider if/how to recalculate mWidth, mHeight if non native CRS is used

if ( !calculateExtent() )
{
Expand Down Expand Up @@ -1288,7 +1291,8 @@ bool QgsWcsProvider::calculateExtent()
// Prefer to use extent from capabilities / coverage description because
// transformation from WGS84 increases the extent
mCoverageExtent = mCoverageSummary.boundingBoxes.value( mCoverageCrs );
if ( !mCoverageExtent.isEmpty() && !mCoverageExtent.isFinite() )
QgsDebugMsg( "mCoverageCrs = " + mCoverageCrs + " mCoverageExtent = " + mCoverageExtent.toString() );
if ( !mCoverageExtent.isEmpty() && mCoverageExtent.isFinite() )
{
QgsDebugMsg( "mCoverageExtent = " + mCoverageExtent.toString() );
return true;
Expand All @@ -1308,9 +1312,11 @@ bool QgsWcsProvider::calculateExtent()
//QgsDebugMsg( "qgisSrsDest: " + qgisSrsDest.toWkt() );

mCoordinateTransform = new QgsCoordinateTransform( qgisSrsSource, qgisSrsDest );

}

QgsDebugMsg( "mCoverageSummary.wgs84BoundingBox= " + mCoverageSummary.wgs84BoundingBox.toString() );

// Convert to the user's CRS as required
try
{
Expand Down

0 comments on commit 3cb4669

Please sign in to comment.