[GRASS-user] v.patch and keeping the attributes

Markus Metz markus.metz.giswork at gmail.com
Mon Oct 29 12:35:09 PDT 2018


On Mon, Oct 29, 2018 at 6:13 PM Mira Kattwinkel <
kattwinkel-mira at uni-landau.de> wrote:
>
> Dear list,
>
> I would like to patch two vector maps together and keep their attributes
> (with the same columns but not in identical order) using v.patch with
> flag -e.

Granted that the two vector maps have attributes in layer 1 which you want
to keep, you can use v.patch -e directly. v.patch will change category
values of all but the first map such that no conflicts with identical
categories from different input maps arise. There is no need to prepare the
input maps with v.category.

v.patch takes care of different column ordering.

HTH,

Markus M

>
> Both maps have cats starting with 1. Hence, I thought I use v.category,
> option 'add' to add a fixed (large enough value) to the categories and
> creating a second layer to keep the attribute values like this:
> v.category input=map1 layer=2 type=line output=map1_cat option=add
> cat=100001
>
> Then I add a table to layer 2 with a column for the old cat:
> v.db.addtable map=map1_cat layer=2 columns="cat_lyr1 integer"
>
> Next, I fill this column (I want to use this column to be able to later
> join the attributes from the original maps):
> v.to.db map=map1_cat layer=2 type=line option=query columns=cat_lyr1
> query_column=cat
>
> Finally, I would like to use v.patch with flag e. However, this works
> only for the table in layer 1. Hence, I wanted to use v.categroy to
> change the layer numbers:
> v.category input=map1_cat layer=2,1 type=line output=map1_cat2
> option=chlayer
>
> And get the warning: WARNING: Database connection and attribute tables
> for concerned layers are not changed
>
> I tried to first drop the table in layer 1 with:
> v.db.droptable -f map=map1_cat
> and then use v.category but that results in the same warning as before.
> Layer 2 is still layer 2.
>
> Can anybody please explain to me what is wrong? I am still struggling to
> get my head around categories and layers but I thought I found a way to
> do it correctly.
>
> Thanks a lot,
> Mira
>
>
> --
> Dr. Mira Kattwinkel
> Quantitative Landscape Ecology
> Institute for Environmental Sciences
> University of Koblenz-Landau
> Fortstraße 7
> 76829 Landau
> Germany
> Phone: + 49 6341 280-31553
> Office: Building I, Room 2.02
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20181029/3332ffed/attachment.html>


More information about the grass-user mailing list