[GRASS-dev] [bug #5043] (grass) r.out.gdal does not
export "g.region -p"
Maciej Sieczka
tutey at o2.pl
Thu Aug 24 10:17:27 EDT 2006
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.
More information about the grass-dev
mailing list