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
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
4. Populate new attribute table with CATs for each vector line:
(make it corresponding to map)
v.to.db map=roadsnew field=2 option=cat type=line col1=cat
5. Upload line lengths of each vector line to attribute table:
v.to.db map=roadsnew field=2 option=length type=line col1=linelength units=me
6. Check with
d.erase
d.vect roadsnew
d.what.vect
7. Extract data (here: shorter than 2000meters):
v.extract roadsnew out=roadsnew_short field=2 where="linelength < 2000"
d.vect roadsnew_short col=red
Note: Initially you may want to use v.build.polylines to build polylines from lines.
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).
Hope this helps
Markus