[GRASS-user] Help: Completely confused about multi-layered vectors trying to import TIGER/Line files

Moritz Lennert mlennert at club.worldonline.be
Thu Feb 28 12:54:09 EST 2008


On 28/02/08 16:39, Tom Russo wrote:
> I have been trying to wrap my brain around "multi-layered" GRASS vectors and
> have only succeeded in wrapping my brain into knots.  Perhaps someone here with 
> a solid understanding of this stuff can help me.
> 

[...]

> 
> Since I'm rambling now, I'll just cut to the chase and ask my question:
> 
>  Given a GRASS vector with two attached database tables, one of which (layer
>  2, attaching attributes to centrois) has a key field POLYID, how can I create 
>  a new layer using a third, much smaller table, that also has a POLYID field, 
>  such that the new layer only contains that subset of centroids where the 
>  third layer table's POLYID matches layer 2's POLYID for that centroid?
> 


I think at this stage your best bet is probably to do something like this:

v.category OldMap option=add layer=3 out=NewMap

#find a link between the category numbers created and the original
# categories, this should work:

v.build OldMap option=cdump > TempFile

# You will have to edit TempFile to only take into account layer 2 and
# then find a way to import the results into your database

v.db.connect -o NewMap layer=3 table=NewTable

#to remove all centroids you do not want:
v.edit tool=delete
or
v.extract

There might be an easier way, though...

I think that you also might want to file a few wishes in the tracker, 
such as:

- extend v.category with an option to use a column linked to an existing 
layer as the cat for a new layer
- allow v.extract to write the results to another layer of the same file 
instead of a different file
- extend v.patch to allow to patch different maps into different layers 
of the output map
- create a v.copy.layers to copy elements of one layer to another

Moritz


More information about the grass-user mailing list