Details Ticket 5043


Comment | Reply | Take | Open


Serial Number 5043
Subject r.out.gdal does not export "g.region -p"
Area grass6
Queue grass
Requestors bjoern.menze@iwr.uni-heidelberg.de
Owner none
Status resolved
Last User Contact Sat Nov 4 19:45:02 2006 (2 yr ago)
Current Priority 30
Final Priority 70
Due No date assigned
Last Action Sat Nov 25 11:23:21 2006 (2 yr ago)
Created Thu Aug 24 14:11:12 2006 (2 yr ago)

Transaction History Ticket 5043


Thu, Aug 24 2006 14:11:12    Request created by guest  
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. (my gdalwarp is also a standard debian binary, GDAL 1.3.1.0, released
2005/10/04.)
on the spearfish60 data set I get the following:


GRASS 6.0.2 (spearfish60):

# exemplary data
d.rast elevation.dem
# set to arbitrary region
g.region n=4926900 s=4923600 e=604800 w=601200
d.redraw

# export to tiff
r.out.tiff input=elevation.dem output=tmp1

# the resulting "tmp1.tif" is equal to 
g.region  n=4926900 s=4923600 e=604800 w=601200
d.redraw
# -> as expected


# export to gtiff
r.out.gdal input=elevation.dem output=tmp2.tif type=UInt16

# the resulting "tmp2.tif" is equal to the full raster file:
g.region county
d.redraw
Thu, Aug 24 2006 14:57:29    Mail sent by neteler@itc.it  
Return-Path <neteler@itc.it>
Delivered-To grass-bugs@lists.intevation.de
Date Thu, 24 Aug 2006 14:57:22 +0200
From Markus Neteler <neteler@itc.it>
To Request Tracker <grass-bugs@intevation.de>
Cc grass-dev@grass.itc.it
Subject Re: [GRASS-dev] [bug #5043] (grass) r.out.gdal does not export "g.region -p"
Message-ID <20060824125722.GH18292@bartok.itc.it>
Mail-Followup-To Request Tracker <grass-bugs@intevation.de>, grass-dev@grass.itc.it
References <20060824121112.6ED5E1006B7@lists.intevation.de>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
In-Reply-To <20060824121112.6ED5E1006B7@lists.intevation.de>
User-Agent Mutt/1.4.1i
X-PGP-Key http://www.gdf-hannover.de/neteler/markus_gpgkey.asc
X-PGP-Fingerprint D4D5 2F80 120E AD60 E2F6 2297 21B3 D02B E1E7 E789
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, hits=-4.264 tagged_above=-999 required=3 tests=[AWL=0.736, BAYES_00=-5]
X-Spam-Level
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?

Markus


Thu, Aug 24 2006 16:17:39    Mail sent by tutey@o2.pl  
Return-Path <tutey@o2.pl>
Delivered-To grass-bugs@lists.intevation.de
Message-ID <44EDB4F7.9070403@o2.pl>
Date Thu, 24 Aug 2006 16:17:27 +0200
From Maciej Sieczka <tutey@o2.pl>
User-Agent Thunderbird 1.5.0.5 (X11/20060728)
MIME-Version 1.0
To Request Tracker <grass-bugs@intevation.de>, grass-dev@grass.itc.it
Subject Re: [GRASS-dev] [bug #5043] (grass) r.out.gdal does not export "g.region -p"
References <20060824121112.6ED5E1006B7@lists.intevation.de> <20060824125722.GH18292@bartok.itc.it>
In-Reply-To <20060824125722.GH18292@bartok.itc.it>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 8bit
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, hits=-4.906 tagged_above=-999 required=3 tests=[AWL=0.094, BAYES_00=-5]
X-Spam-Level
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.


Thu, Aug 24 2006 17:42:30    Mail sent by paul-grass@stjohnspoint.co.uk  
Return-Path <paul-grass@stjohnspoint.co.uk>
Delivered-To grass-bugs@lists.intevation.de
Date Thu, 24 Aug 2006 16:41:22 +0100 (BST)
From Paul Kelly <paul-grass@stjohnspoint.co.uk>
X-X-Sender paulk@agrippa.ukshells.co.uk
To Markus Neteler <neteler@itc.it>
Cc Request Tracker <grass-bugs@intevation.de>, grass-dev@grass.itc.it
Subject Re: [GRASS-dev] [bug #5043] (grass) r.out.gdal does not export "g.region -p"
In-Reply-To <20060824125722.GH18292@bartok.itc.it>
Message-ID <Pine.LNX.4.62.0608241638500.21044@agrippa.ukshells.co.uk>
References <20060824121112.6ED5E1006B7@lists.intevation.de> <20060824125722.GH18292@bartok.itc.it>
MIME-Version 1.0
Content-Type TEXT/PLAIN; charset=US-ASCII; format=flowed
X-SA-Do-Not-Run Yes
X-SA-Exim-Connect-IP 217.10.143.90
X-SA-Exim-Mail-From paul-grass@stjohnspoint.co.uk
X-SA-Exim-Scanned No (on mail.ukshells.net); SAEximRunCond expanded to false
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, hits=-4.351 tagged_above=-999 required=3 tests=[AWL=0.649, BAYES_00=-5]
X-Spam-Level

On Thu, 24 Aug 2006, Markus Neteler wrote:

> 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:

This would seem like a good example of why Glynn insisted on retaining 
r.resample. r.resample to a temporary file and export that would achieve 
the desired effect (i.e. consistent with other raster export modules) I 
think? Although would require twice as much disk space. I agree it should 
be made consistent (i.e. export based on the current region settings).

Paul


Thu, Aug 24 2006 19:37:42    Mail sent by glynn@gclements.plus.com  
Return-Path <glynn@gclements.plus.com>
Delivered-To grass-bugs@lists.intevation.de
From Glynn Clements <glynn@gclements.plus.com>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Message-ID <17645.58337.523881.575037@cerise.gclements.plus.com>
Date Thu, 24 Aug 2006 18:37:37 +0100
To Paul Kelly <paul-grass@stjohnspoint.co.uk>
Cc Markus Neteler <neteler@itc.it>, Request Tracker <grass-bugs@intevation.de>, grass-dev@grass.itc.it
Subject Re: [GRASS-dev] [bug #5043] (grass) r.out.gdal does not export "g.region -p"
In-Reply-To <Pine.LNX.4.62.0608241638500.21044@agrippa.ukshells.co.uk>
References <20060824121112.6ED5E1006B7@lists.intevation.de> <20060824125722.GH18292@bartok.itc.it> <Pine.LNX.4.62.0608241638500.21044@agrippa.ukshells.co.uk>
X-Mailer VM 7.07 under 21.4 (patch 15) "Security Through Obscurity" XEmacs Lucid
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, hits=-4.023 tagged_above=-999 required=3 tests=[AWL=0.977, BAYES_00=-5]
X-Spam-Level
Paul Kelly 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:
> 
> This would seem like a good example of why Glynn insisted on retaining 
> r.resample. r.resample to a temporary file and export that would achieve 
> the desired effect (i.e. consistent with other raster export modules) I 
> think? Although would require twice as much disk space. I agree it should 
> be made consistent (i.e. export based on the current region settings).

I would suggest that r.out.gdal should behave like other export
modules and use the current region. If you want "raw" export; you can
always use "g.region rast=..." first.

r.in.* modules are a special case, as you can't use "g.region rast="
before you've imported the raster.

-- 
Glynn Clements <glynn@gclements.plus.com>


Fri, Aug 25 2006 05:01:18    Mail sent by hamish_nospam@yahoo.com  
Return-Path <hamish_nospam@yahoo.com>
Delivered-To grass-bugs@lists.intevation.de
Date Fri, 25 Aug 2006 15:00:54 +1200
From Hamish <hamish_nospam@yahoo.com>
To Glynn Clements <glynn@gclements.plus.com>
Cc paul-grass@stjohnspoint.co.uk, neteler@itc.it, grass-bugs@intevation.de, grass-dev@grass.itc.it
Subject Re: [GRASS-dev] [bug #5043] (grass) r.out.gdal does not export "g.region -p"
Message-Id <20060825150054.4014dfa8.hamish_nospam@yahoo.com>
In-Reply-To <17645.58337.523881.575037@cerise.gclements.plus.com>
References <20060824121112.6ED5E1006B7@lists.intevation.de> <20060824125722.GH18292@bartok.itc.it> <Pine.LNX.4.62.0608241638500.21044@agrippa.ukshells.co.uk> <17645.58337.523881.575037@cerise.gclements.plus.com>
X-Mailer Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
X-Face M<EoB)"*Z~u!,vFhXmw}R_KbdBta*P_=T|rbBL'e1/CQ9;/1g\BU3&!=y8ria$2Uk!HT&BB 8i?|X_+7~1jsy}F~g$2va%3fV`*=L(*cem[@3\yg,G,@rg6/QMJ
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, hits=-1.557 tagged_above=-999 required=3 tests=[AWL=0.743, BAYES_00=-5, FORGED_YAHOO_RCVD=2.7]
X-Spam-Level
> > >> this bug's URL: http://intevation.de/rt/webrt?serial_num=5043
> > >------------------------------------------------------------------
..
> > >> r.out.gdal does export the region as defined in "g.region -p",
> > >> but the full input raster file.

Paul:
> > This would seem like a good example of why Glynn insisted on
> > retaining  r.resample. r.resample to a temporary file and export
> > that would achieve  the desired effect (i.e. consistent with other
> > raster export modules) I  think? Although would require twice as
> > much disk space. I agree it should  be made consistent (i.e. export
> > based on the current region settings).

Glynn:
> I would suggest that r.out.gdal should behave like other export
> modules and use the current region. If you want "raw" export; you can
> always use "g.region rast=..." first.
> 
> r.in.* modules are a special case, as you can't use "g.region rast="
> before you've imported the raster.


Yes, r.out.gdal should act like other raster modules and work from the
current region. But this goes back to r.out.gdal should be a real module
instead of a wrapper script. Then we could do away with the gdal-plugin
dependancy for generic raster output, which I think is a bit of an
unnecessary burden for regular users to have to worry about for expected
functionality.

Frank's comments from some time ago,  ;)
  http://article.gmane.org/gmane.comp.gis.grass.devel/4657



Hamish


Sat, Nov 4 2006 19:26:40    Status changed to resolved by mneteler  
Sat, Nov 4 2006 19:26:40    Mail sent by mneteler  
Hi,

r.out.gdal was rewritten in GRASS 6.3 as C implementation.
It should now work as expected.

We assume that the problem is solved. Feel free to re-open if not.

Markus

Sat, Nov 4 2006 19:45:02    Mail sent by menze@uni-hd.de  
Return-Path <menze@uni-hd.de>
Delivered-To grass-bugs@lists.intevation.de
Message-ID <001b01c70041$52e5e1e0$6402a8c0@fuji>
From "bjoern menze" <menze@uni-hd.de>
To "Markus Neteler via RT" <grass-bugs@intevation.de>
References <20061104182640.81BC4101F00@lists.intevation.de>
Subject Re: [bug #5043] (grass) r.out.gdal does not export
Date Sat, 4 Nov 2006 19:44:51 +0100
MIME-Version 1.0
Content-Type text/plain; format=flowed; charset="iso-8859-1"; reply-type=original
Content-Transfer-Encoding 7bit
X-Priority 3
X-MSMail-Priority Normal
X-Mailer Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE Produced By Microsoft MimeOLE V6.00.2900.2962
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, hits=0.5 tagged_above=-999 required=3 tests=[BAYES_20=-1, INTEVATION_DOTLESS_MSGID=1.5]
X-Spam-Level
Thank you!
Bjoern



---

bjoern menze
menze @ uni-hd de
# 0170 5894150 (mobil)
# 06221 548829 (institut)
# 06221 470787 (heidelberg)
bergstrasse 42  69120 heidelberg

----- Original Message ----- 
From: "Markus Neteler via RT" <grass-bugs@intevation.de>
To: <bjoern.menze@iwr.uni-heidelberg.de>
Sent: Saturday, November 04, 2006 7:26 PM
Subject: [bug #5043] (grass) r.out.gdal does not export 


> Hi,
> 
> r.out.gdal was rewritten in GRASS 6.3 as C implementation.
> It should now work as expected.
> 
> We assume that the problem is solved. Feel free to re-open if not.
> 
> Markus
> 
> 
> 
> -------------------------------------------- Managed by Request Tracker


Sat, Nov 4 2006 19:45:02    Status changed to open by _rt_system  
Sat, Nov 25 2006 11:23:21    Status changed to resolved by mneteler  
Comment | Reply | Take | Open

You are currently authenticated as guest.
[Show Configuration] [Login as another user]

Users Guide - Mail Commands - Homepage of RequestTracker 1.0.7 - list any request