Skip to content

Commit 24960da

Browse files
committedNov 1, 2015
[GRASS] set proj/zone on imported rasters, fixes #13725
1 parent daa6510 commit 24960da

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
 

‎src/providers/grass/qgis.r.in.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ int main( int argc, char **argv )
108108
stdoutFile.open( stdout, QIODevice::WriteOnly | QIODevice::Unbuffered );
109109
QDataStream stdoutStream( &stdoutFile );
110110

111+
qint32 proj, zone;
112+
stdinStream >> proj >> zone;
113+
111114
QgsRectangle extent;
112115
qint32 rows, cols;
113116
stdinStream >> extent >> cols >> rows;
@@ -118,6 +121,8 @@ int main( int argc, char **argv )
118121
{
119122
G_fatal_error( "Cannot set region: %s", err.toUtf8().data() );
120123
}
124+
window.proj = ( int ) proj;
125+
window.zone = ( int ) zone;
121126

122127
G_set_window( &window );
123128

‎src/providers/grass/qgsgrassimport.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,14 @@ bool QgsGrassRasterImport::import()
241241
return false;
242242
}
243243

244+
245+
struct Cell_head defaultWindow;
246+
if ( !QgsGrass::defaultRegion( mGrassObject.gisdbase(), mGrassObject.location(), &defaultWindow ) )
247+
{
248+
setError( "Cannot get default window" );
249+
return false;
250+
}
251+
244252
int redBand = 0;
245253
int greenBand = 0;
246254
int blueBand = 0;
@@ -326,6 +334,8 @@ bool QgsGrassRasterImport::import()
326334

327335
QDataStream outStream( mProcess );
328336

337+
outStream << ( qint32 ) defaultWindow.proj;
338+
outStream << ( qint32 ) defaultWindow.zone;
329339
outStream << mExtent << ( qint32 )mXSize << ( qint32 )mYSize;
330340
outStream << ( qint32 )qgis_out_type;
331341

0 commit comments

Comments
 (0)
Please sign in to comment.