[GRASS-user] Seeking vector layer tutorial

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.

Thanks,

  -k.

On Fri, Mar 8, 2019 at 9:22 PM Ken Mankoff <mankoff@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

Hi Markus,

Thank you for your reply and help. I'm starting to gain a better understanding of the power and complexity of the GRASS vector implementation.

  -k.

On 2019-03-10 at 21:09 +0100, Markus Metz
<markus.metz.giswork@gmail.com> wrote...

On Fri, Mar 8, 2019 at 9:22 PM Ken Mankoff <mankoff@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