[GRASS-user] d.rast.edit does not save edited cells (?)

Glynn Clements glynn at gclements.plus.com
Thu Feb 21 21:32:34 EST 2008


Nikos Alexandris wrote:

> Hmmm... ! I though that it works as follows (and did):
> 
> 1. Open a raster and give a name for the new raster (open a raster with
> areas, all having the same value "5")
> 
> 2. edit, save, exit (I "erased lots of pixels from various areas by
> assigning the * -- that is NULL, no?)
> 
> 3. load the NEW raster and see the changes (I load the NEW raster and it
> is identical with the old map)
> 
> 
> Is it the * values? Effects take place with non-NULL values maybe?

Ah. I have just realised that d.rast.edit won't allow you to set cells
to null.

The problem is this:


d.rast.edit only works on a portion of the map (an editing window with
100,000 cells would consume vast amounts of memory and be
impractically slow). When you save the map, or switch to a different
portion, it imports the edited portion into grass as a separate map
(using r.in.ascii), and merges it with rest of the map using r.patch.

However, this only replaces non-null cells. Any null cells result in
the corresponding cells in the orignal map remaining untouched.

I could fix d.rast.edit to use r.mapcalc instead of r.patch. But it
might be better to add an option to r.patch to support this type of
usage.

In the meantime, the only solution I can offer is to use a cell value
which doesn't occur in the map being edited in place of the null
value, then use r.null to change that value to null once editing is
complete.

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


More information about the grass-user mailing list