[GRASS-user] negative categories?

Hamish hamish_b at yahoo.com
Sat Oct 10 01:30:27 EDT 2009


Achim wrote:
> from a raster map I get vector polygons with r.to.vect.
> As I use the -v flag, I get one category-number for each
> value. This is what I want.
> 
> My problem: v.to.db does not update negative cats! Is there
> any way to handle this?
> 
> I dont want to loose the identification, nor miss the -v Flag: Having
> raster-values in a column "value" is not clean, due to the fact, that I
> have eg. to remove small trapped cells, calc center of gravity and more.


the key column ID is meant to be a positive number. attribute columns can
be whatever you like.

You can keep a form of the number positive with r.mapcalc, e.g.:


r.mapcalc "pos_map = if( orig_map <= 0, 100000 - orig_map, orig_map )"


then -5 becomes 100005, etc.


some SQL magic can add a new column for the vector map and repopulate it
with the original +/- values.


Hamish



      



More information about the grass-user mailing list