[GRASS-dev] [bug #5043] (grass) r.out.gdal does not export "g.region -p"

William Kyngesburye woklist at kyngchaos.com
Thu Aug 24 11:11:36 EDT 2006


I knew there was another reason I preferred r.out.tiff (besides  
easier to remember options).  r.out.tiff uses the region settings.

On Aug 24, 2006, at 9:17 AM, Maciej Sieczka wrote:

> Markus Neteler napisa?(a):
>> On Thu, Aug 24, 2006 at 02:11:12PM +0200, Request Tracker wrote:
>>> this bug's URL: http://intevation.de/rt/webrt?serial_num=5043
>>> -------------------------------------------------------------------- 
>>> -----
>>>
>>> Subject: r.out.gdal does not export "g.region -p"
>>>
>>> Platform: GNU/Linux/x86
>>> grass obtained from: Other (CDROM etc)
>>> grass binary for platform: Downloaded precompiled Binaries
>>> GRASS Version: GRASS 6.0.2 (2006)
>>>
>>>
>>> r.out.gdal does export the region as defined in "g.region -p",  
>>> but the full input raster file.
>>
>> I just found that it is pretty easy to support at least
>> the current region extent:
>>
>> diff -u -r1.24 r.out.gdal
>> --- r.out.gdal  19 Aug 2006 12:52:24 -0000      1.24
>> +++ r.out.gdal  24 Aug 2006 12:54:58 -0000
>> @@ -129,9 +129,11 @@
>>    unset METAKEY
>>  fi
>>
>> +eval `g.region -g`
>> +
>>  #do it
>>  CELLHD=`echo $file | sed 's+/cell/+/cellhd/+g'`
>>  echo "Writing format: $FORMAT"
>>  echo "Writing type:   $TYPE"
>> -gdal_translate -of $FORMAT -ot $TYPE $CREATEKEY $METAKEY $CELLHD  
>> $OUTPUT
>> +gdal_translate -of $FORMAT -ot $TYPE $CREATEKEY $METAKEY -projwin  
>> $w $n $e $s $CELLHD $OUTPUT
>>
>>
>> For current resolution support, I have no idea.
>>
>> Opinions about above change?
>
> I personally like the way r.out.gdal behaves now, as usually I need to
> export full rasters I create, not a parts of them. Present r.out.gdal
> bahaviour saves me fiddling with g.region prior to export. The
> trim-to-current-region behavior would be nice as an option though (no
> need for intermediate r.mapcalc then). My 0,01 PLN.
>
> As to resolution, maybe this would work:
>
> gdalwarp -of $FORMAT -ot $TYPE $CREATEKEY -te $w $n $e $s -tr $ewres
> $nsres $CELLHD $OUTPUT
>
> I don't know how to substitute gdal_translate's -mo in gdalwarp. -wo?
>
> Maciek
>
> P.S.
> If the gdalwarp approach would be OK, this report would become a
> duplicate of wish http://intevation.de/rt/webrt?serial_num=3271.
>
> _______________________________________________
> grass-dev mailing list
> grass-dev at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev

-----
William Kyngesburye <kyngchaos at kyngchaos.com>
http://www.kyngchaos.com/

"This is a question about the past, is it? ... How can I tell that  
the past isn't a fiction designed to account for the discrepancy  
between my immediate physical sensations and my state of mind?"

- The Ruler of the Universe




More information about the grass-dev mailing list