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

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.

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

On Mon, Oct 29, 2018 at 6:13 PM Mira Kattwinkel <kattwinkel-mira@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@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Thanks a lot!

I just did not interpret the paragraph “When using the -a flag…” correctly.

Maybe a note in the manual that v.patch takes care of the cats etc. would be helpful.

Mira

···

On 29/10/18 20:35, Markus Metz wrote:

On Mon, Oct 29, 2018 at 6:13 PM Mira Kattwinkel <kattwinkel-mira@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@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

-- 
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

Dear Markus,

I saw that you updated v.patch to ignore the order of columns some months ago. However, I updated my grass to version 7.4.2. (on Linux Mint 18) and still get “ERROR: Column names differ”

I am sure that they are the same, only the order is different.

Do you have any suggestions?

Mira

···

On 29/10/2018 20:35, Markus Metz wrote:

On Mon, Oct 29, 2018 at 6:13 PM Mira Kattwinkel <kattwinkel-mira@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@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

-- 
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

On Tue, Oct 30, 2018 at 2:21 PM Mira Kattwinkel <kattwinkel-mira@uni-landau.de> wrote:

Dear Markus,

I saw that you updated v.patch to ignore the order of columns some months ago. However, I updated my grass to version 7.4.2. (on Linux Mint 18) and still get “ERROR: Column names differ”

I am sure that they are the same, only the order is different.

Do you have any suggestions?

This is not a bug fix but a new feature, only available in GRASS 7.6 and 7.7.

Markus M

Mira

On 29/10/2018 20:35, Markus Metz wrote:

On Mon, Oct 29, 2018 at 6:13 PM Mira Kattwinkel <kattwinkel-mira@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@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


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

Hi Mira,

On Tue, Oct 30, 2018 at 10:26 AM Mira Kattwinkel
<kattwinkel-mira@uni-landau.de> wrote:

Thanks a lot!

I just did not interpret the paragraph "When using the -a flag..." correctly.

Maybe a note in the manual that v.patch takes care of the cats etc. would be helpful.

if you could send a (draft) text addition to me, I'll merge it into the manual.

thanks
markusN

On Tue, Oct 30, 2018 at 5:36 PM Markus Neteler <neteler@osgeo.org> wrote:

On Tue, Oct 30, 2018 at 10:26 AM Mira Kattwinkel:
>
> Thanks a lot!
>
> I just did not interpret the paragraph "When using the -a flag..." correctly.
>
> Maybe a note in the manual that v.patch takes care of the cats etc. would be helpful.

if you could send a (draft) text addition to me, I'll merge it into the manual.

Based on Mira's offlist sent text snippet, I would add this text under "NOTES":

"When using the -e flag, v.patch assigns new, unique category (cat)
values so that no overlapping category numbers occur in the
output. Hence, there is no need to run v.category beforehand."

Is that correct?

thanks
markusN

On Tue, Oct 30, 2018 at 9:13 PM Markus Neteler <neteler@osgeo.org> wrote:

On Tue, Oct 30, 2018 at 5:36 PM Markus Neteler <neteler@osgeo.org> wrote:

On Tue, Oct 30, 2018 at 10:26 AM Mira Kattwinkel:

Thanks a lot!

I just did not interpret the paragraph “When using the -a flag…” correctly.

Maybe a note in the manual that v.patch takes care of the cats etc. would be helpful.

if you could send a (draft) text addition to me, I’ll merge it into the manual.

Based on Mira’s offlist sent text snippet, I would add this text under “NOTES”:

“When using the -e flag, v.patch assigns new, unique category (cat)
values so that no overlapping category numbers occur in the
output. Hence, there is no need to run v.category beforehand.”

Is that correct?

How about:

“When using the -e flag, v.patch shifts category (cat) values in the output so that category numbers from the different input maps do not overlap. This shift is applied to both the category values of the features and the category values in the attribute tables. Hence, there is no need to run v.category and v.db.update beforehand.”

Markus M

thanks
markusN

Sounds good and precise to me.

Mira

···

On 30/10/2018 21:34, Markus Metz wrote:

On Tue, Oct 30, 2018 at 9:13 PM Markus Neteler <neteler@osgeo.org> wrote:

On Tue, Oct 30, 2018 at 5:36 PM Markus Neteler <neteler@osgeo.org> wrote:

On Tue, Oct 30, 2018 at 10:26 AM Mira Kattwinkel:

Thanks a lot!

I just did not interpret the paragraph “When using the -a flag…” correctly.

Maybe a note in the manual that v.patch takes care of the cats etc. would be helpful.

if you could send a (draft) text addition to me, I’ll merge it into the manual.

Based on Mira’s offlist sent text snippet, I would add this text under “NOTES”:

“When using the -e flag, v.patch assigns new, unique category (cat)
values so that no overlapping category numbers occur in the
output. Hence, there is no need to run v.category beforehand.”

Is that correct?

How about:

“When using the -e flag, v.patch shifts category (cat) values in the output so that category numbers from the different input maps do not overlap. This shift is applied to both the category values of the features and the category values in the attribute tables. Hence, there is no need to run v.category and v.db.update beforehand.”

Markus M

thanks
markusN

-- 
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

On Wed, Oct 31, 2018 at 10:58 AM Mira Kattwinkel <kattwinkel-mira@uni-landau.de> wrote:

Sounds good and precise to me.

OK, the manual has been updated in G77, G76 with r73635,6

Markus M

Mira

On 30/10/2018 21:34, Markus Metz wrote:

On Tue, Oct 30, 2018 at 9:13 PM Markus Neteler <neteler@osgeo.org> wrote:

On Tue, Oct 30, 2018 at 5:36 PM Markus Neteler <neteler@osgeo.org> wrote:

On Tue, Oct 30, 2018 at 10:26 AM Mira Kattwinkel:

Thanks a lot!

I just did not interpret the paragraph “When using the -a flag…” correctly.

Maybe a note in the manual that v.patch takes care of the cats etc. would be helpful.

if you could send a (draft) text addition to me, I’ll merge it into the manual.

Based on Mira’s offlist sent text snippet, I would add this text under “NOTES”:

“When using the -e flag, v.patch assigns new, unique category (cat)
values so that no overlapping category numbers occur in the
output. Hence, there is no need to run v.category beforehand.”

Is that correct?

How about:
“When using the -e flag, v.patch shifts category (cat) values in the output so that category numbers from the different input maps do not overlap. This shift is applied to both the category values of the features and the category values in the attribute tables. Hence, there is no need to run v.category and v.db.update beforehand.”

Markus M

thanks
markusN


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