[GRASSLIST:3995] Re: how to access built-in vector attributes (GRASS 5.7)?

William K woklist at charter.net
Thu Jul 22 14:42:25 EDT 2004


On Jul 22, 2004, at 7:06 AM, Markus Neteler wrote:

> On Wed, Jul 21, 2004 at 03:59:41PM -0500, William K wrote:
>> Or whatever they're called.  Right now I'm looking at lines.  When you
>> d.what.vect, it shows cats, fields and attributes, and length and line
>> height.  I haven't checked polgons yet, but I'm guessing they have
>> perimeter and area instead of length.
>>
>> 1. I would like to v.extract to extract lines above a certain length -
>> ie weed out those short blips.
>
> You need to use v.to.db.
>
> 1. use db.execute create a new table:
>
>  Example:
>   echo "CREATE TABLE roadlength (cat integer, linelength double)" | 
> db.execute
>
>   Link this table as second table to your map:
>
>   #check current settings:
>   v.db.connect -p roads2
>
>   #link new table:
>   v.db.connect m=roads2 dr=dbf 
> data='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf' \
>                key=cat table=roadlength field=2
>
> 2. Verify that the new tables exists now:
>
>   v.info -c roads2
>   v.info -c roads2 field=2
>
Odd.  Even tho field 2 is used to connect, v.info -c reports field 1 
having the DB.  v.info -c f=2 says database connection not defined.  
But the following steps work.  Bug in v.info?

> 3. Generate new categories in the map:
>   v.category roads2 out=roadsnew field=2 option=add
>   v.category input=roadsnew option=report
>
>   # should report something like this (for field=2):
>   #  type       count        min        max
>   #  line         825          1        825
>   # -> 825 lines in this map
>
Can't do this in-place?


>> 2. I want to export the lines with line height as an attribute.  Not
>> important now, but labelling lines with line height, using different
>> colors... (not ready to mess with NVIZ yet, but maybe that's the only
>> way?), or extracting certain line heights or ranges of heights.
>
> ... see above (now you should be able to do that).
>
where do I get the line height from?  I didn't see it as an option for 
v.to.db.

-----
William Kyngesburye <kyngchaos at charter.net>
http://webpages.charter.net/kyngchaos/

All generalizations are dangerous, even this one.




More information about the grass-user mailing list