Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[GRASS] set proj/zone on imported rasters, fixes #13725
(cherry picked from commit 24960da)
  • Loading branch information
blazek committed Nov 1, 2015
1 parent 721856a commit 17399c0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/providers/grass/qgis.r.in.cpp
Expand Up @@ -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;
Expand All @@ -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 );

Expand Down
10 changes: 10 additions & 0 deletions src/providers/grass/qgsgrassimport.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 17399c0

Please sign in to comment.