[GRASS-user] Can't dissolve based on column?

Hamish hamish_b at yahoo.com
Wed Jan 16 21:10:28 EST 2008


Hamish wrote:
> The v.dissolve script with dissolve based on a column currently
> requires that column to be of type integer.

or, it turns out, string is ok too.

(what does 'v.info -c' say for you?)

> We should probably add a check in the script for that (v.info -c).

done.

> v.dissolve with column= calls v.reclass to change the key column from
> the usual 'cat' column to something else. By definition the key
> column must be type integer.
> 
> v.reclass options help:
>   column   The name of the column values of which are used as new
> categories. The column must be type integer.

the option description was wrong, it can take type integer or string
columns. fixed in svn/trunk.

> It would be possible to add any type of column to v.dissolve with
> unix tools 'db.select | sort | uniq | nl' then create a new table
> with the unique attributes + sequential integer column, then
> v.reclass as before.
>
> or add a new column to (a copy of) the existing table (v.db.addcol)
> and
> populate it with a 'db.select | sort | uniq' loop and v.db.update, or
> SQL + db.execute << "set DISOLVEKEY = $i where ATTRIBUTE = '$VAL'"
> (sorry my SQL is not good but you may be the idea of what I mean)

v.reclass's main.c does something like this already.

> actually, I kind of thought Markus had already coded it like that.
> Guess not.

.... turns out Radim had done this after all.


You should still have gotten a column type error from v.reclass, it
does check. Not sure why you didn't. Maybe some bug in v.reclass.


Changes are untested as the v.dissolve & v.reclass help page examples
are not using the standard sample datasets AFAICT.


Hamish



      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping



More information about the grass-user mailing list