[GRASS-dev] Re: [GRASS-user] problems using r.proj with large data set

Glynn Clements glynn at gclements.plus.com
Thu Feb 8 06:12:18 EST 2007

William Kyngesburye wrote:

> I just had a reason to try this out (nearly forgot about it).  I'm a  
> little confused - you say here that the cache size is fixed, yet  
> there is an option to set the cache size (in MB) mentioned in the  
> docs.  Maybe this was added later?

Yes. The current version defauxts to 2*(nx+ny) blocks, but can be
overriden via the memory= option.

> The docs should probably also be updated with info relevant to  
> r.proj.seg, instead of being a straight copy of the r.proj description.

The only thing that differs between the two is the memory= option. I'm
not sure what needs to be said about that option beyond what's already
in its description string.

> On to trying to run it - tempfile problems (I recall seeing something  
> about tempfiles on the list).

Right; it needs to create a temporary file.

> In location saproj, mapset srtm.  Projecting data from location world  
> (LL proj), mapset sa, map sa (7.5GB):
>  > r.proj.seg loc=world map=sa in=sa out=srtm
> Input Projection Parameters: blah blah
> Output Projection Parameters: blah blah
> Input: blah blah
> Output: blah blah
> ERROR: can't make mapset element .tmp/Sumomo.local
>         (/Volumes/Guu/gis/grassdb/world/srtm/.tmp)
> [it doesn't get to the "Allocating memory and reading input map..."  
> message]
> ... how the heck is it getting world/srtm as the current mapset (for  
> creating temp files in)!?  It should be saproj/srtm.  Somehow the  
> location is getting mixed up.


r.proj.seg (and r.proj) both work by switching environments between
the input and output locations. It appears to be creating the
temporary file while the input location is active, when it should be
using the output location (you may not have write permission for the
input location).

Thanks for discovering this; I'll apply the following as soon as I've
tested it:

--- raster/r.proj.seg/readcell.c	19 Dec 2006 13:24:54 -0000	1.3
+++ raster/r.proj.seg/readcell.c	8 Feb 2007 10:59:22 -0000
@@ -51,7 +51,10 @@
 	if (nblocks < nx * ny)
+		/* Temporary file must be created in output location */
+		G__switch_env();
 		filename = G_tempfile();
+		G__switch_env();
 		c->fd = open(filename, O_RDWR|O_CREAT|O_EXCL, 0600);
 		if (c->fd < 0)
 			G_fatal_error("Unable to open temporary file");

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-user mailing list