[GRASS] set proj/zone on imported rasters, fixes #13725

This commit is contained in:
Radim Blazek 2015-11-01 17:56:09 +01:00
parent daa6510970
commit 24960da08a
2 changed files with 15 additions and 0 deletions

View File

@ -108,6 +108,9 @@ int main( int argc, char **argv )
stdoutFile.open( stdout, QIODevice::WriteOnly | QIODevice::Unbuffered );
QDataStream stdoutStream( &stdoutFile );
qint32 proj, zone;
stdinStream >> proj >> zone;
QgsRectangle extent;
qint32 rows, cols;
stdinStream >> extent >> cols >> rows;
@ -118,6 +121,8 @@ int main( int argc, char **argv )
{
G_fatal_error( "Cannot set region: %s", err.toUtf8().data() );
}
window.proj = ( int ) proj;
window.zone = ( int ) zone;
G_set_window( &window );

View File

@ -241,6 +241,14 @@ bool QgsGrassRasterImport::import()
return false;
}
struct Cell_head defaultWindow;
if ( !QgsGrass::defaultRegion( mGrassObject.gisdbase(), mGrassObject.location(), &defaultWindow ) )
{
setError( "Cannot get default window" );
return false;
}
int redBand = 0;
int greenBand = 0;
int blueBand = 0;
@ -326,6 +334,8 @@ bool QgsGrassRasterImport::import()
QDataStream outStream( mProcess );
outStream << ( qint32 ) defaultWindow.proj;
outStream << ( qint32 ) defaultWindow.zone;
outStream << mExtent << ( qint32 )mXSize << ( qint32 )mYSize;
outStream << ( qint32 )qgis_out_type;