[GRASS-user] Seeking vector layer tutorial

Markus Metz markus.metz.giswork at gmail.com
Sun Mar 10 13:09:10 PDT 2019


On Fri, Mar 8, 2019 at 9:22 PM Ken Mankoff <mankoff at gmail.com> wrote:
>
> Hello,
>
> I'm trying to gain proficiency w/ GRASS vectors & layers. I've read
https://grass.osgeo.org/grass76/manuals/vectorintro.html and
https://grasswiki.osgeo.org/wiki/Vector_Database_Management a few times,
but am still not clear on how to create layers.
>
> I have three vector layers: BASINS, STREAMS, and OUTLETS. All basins have
outlets. All streams have outlets. Not all basins have streams (some small
basins have no streams but still have an outlet).
>
> I can merge these three with v.patch, but they're all in one layer. I
thought it might make sense for each to exist on its own layer. Or perhaps
my misconception is that they cannot - it is the attribute tables that
exist on separate layers?
>
> If someone can provide an example how to combine these there vectors, or
link to a tutorial, I would be grateful.

In this example, there are three vectors, each with one layer which is
probably for all layer number 1.

If you want to patch these three vectors together such that each input
vector with one layer ends up in one individual layer in the output vector,
you need to do some preparation, e.g.:

Keep vector layer 1 for BASINS.

Change vector layer 1 for STREAMS to layer 2 with
v.category in=STREAMS out=STREAMS_l2 op=chlayer layer=1,2

Change vector layer 1 for OUTLETS to layer 3 with
v.category in=OUTLETS out=OUTLETS_l3 op=chlayer layer=1,3

patch them together with
v.patch in=BASINS,STREAMS_l2,OUTLETS_l3 out=...

In order to copy attributes, you need to copy the attribute  tables of the
input vectors BASINS, STREAMS, and OUTLETS.

The attribute tables linked to the original input vectors are printed with
v.db.connect -p or v.db.connect -g.

Now copy the tables with db.copy and link them to corresponding layer of
the patched output using v.db.connect.

HTH,

Markus M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20190310/0e3013bd/attachment.html>


More information about the grass-user mailing list