[GRASSLIST:4232] Re: Generating new linked attribute table after v.overlay

Craig Aumann caumann at ualberta.ca
Mon Aug 23 14:36:22 EDT 2004


I'm afraid that's only part of the solution I need. Imagine you have a
trail (represented as a polygon in a separate map layer) running through
different kinds of vegetation types. Each polygon in the vegetation map
links off to an attribute table.  I want to overlap the trail with the
vege map so that I know which parts of the trail are in which types of
vegetation and upload this information to the original attribute table
so that each distinct trail-vegetation type polygon links to its own
record in the database. After this, I will then do another v.overlay 
(with option NOT) so that the trail will then be represented with
distinct vegetative types (i.e., TRAIL-ASPEN, or TRAIL-PINE) in the
map.    

See my code below for precisely what I mean.  

## Set the CAT values according to the vegetative classes.  
v.reclass input=vegelayer output=vegereclass type=area \
    field=2 col=cover

## Do the overlay. 
v.overlay ainput=seismicinterclean binput=vegereclass bfield=1 \
    output=seismicvegetemp operator=and

## Create new CAT values in field 2.  These will be used so that each
## vegetative polygon in the overlay links to a single row in the
## table.  I add 1000000 to ensure these values are distinct from the
## previous values used to link this table to the original "vegelayer"
## map.   

v.category input=vegereclass output=seismicvegetemp2 \
    option=add field=2
v.category input=seismicvegetemp2 output=seismicvegetemp3 \
    option=sum field=2 cat=1000000


## Connect the map to this table.  
v.db.connect  -o map=seismicvegetemp3 table=play_att \
    field=2 key=link_key \
    driver=pg database="dbname=alpac_netdown,user=caumann"

## Create new rows in the table for each new polygon 
## resulting from the overlay.  
v.to.db  map=seismicvegetemp3 field=2 option=cat type=centroid


NOW, HOW DO I UPLOAD THE CAT VALUES IN FIELD 1 (WHICH CONTAIN THE
VEGE STATE CLASS THIS POLYGON INTERESECTED) TO THE TABLE SO
THAT I CAN EXECUTE QUERIES AND ASSIGN NEW STATE CLASSES USING THOSE
VALUES?????


Cheers!
Craig


On Mon, 2004-08-23 at 03:57, Radim Blazek wrote:
> Reclass first input vectors by state ID (v.reclass col=STATE),
> then run v.overlay and the table linked to field 1 contains
> what you want.
> 
> Radim
> 
> On Saturday 21 August 2004 00:54, Craig Aumann wrote:
> > I'm working in 5.7.
> >
> > Suppose we have two polygons which have attributes linked to an
> > associated PostGRESQL database.
> >
> > i.e.
> >
> > ----------------
> >
> > |   1   |  2    |
> >
> > -----------------
> >
> > linking off to a table:
> >
> > LINK_KEY   STATE
> > 1           57
> > 2           59
> >
> >
> > I now overlay  another polygon:
> > ----------------
> >
> > |   10  |  11   |
> >
> > *******************
> >
> > |   12  |  13   |
> >
> > ******************
> >
> > |   14  |  15   |
> >
> > -----------------
> >
> > and what I want to do is end up with an associated table linked to the
> > result of the overlay that looks like this:
> >
> > LINK_KEY  STATE NEW_STATE
> > 10          57       57
> > 11          59       59
> > 12          57      157
> > 13          59      159
> > 14          57       57
> > 15          59       59
> >
> > I need a few kicks in the right direction (alright, I need to have my
> > hand held in a major way!) to figure out how to proceed following
> > v.overlay to  ensure that each new polygon resulting from the overlay
> > has one (and only one!) unique link_key into the new attribute table AND
> > also how to do the associated query processing based on the STATE (and
> > other columns) of the original polygons (stored in their original linked
> > table above) which the overlaid polygon intersects.
> >
> >
> > Thanks!
> > Craig
> 




More information about the grass-user mailing list