[GRASS-user] Merge lines into common categories based an attribute information

Hi,

how can I merge multiple lines into one category based on some attribute information.
For example I have a line vector consisting of 10 lines and several lines belong to three different groups (lines belonging to the same group share the same value in a specific attribute column). Now I’d like to merge them (assign a common cats) and create an new attribute with the “group value” as new category (the table should then have 3 rows)? I think this should be easily possible, but I could not yet find the correct tool.

Afterwards I’d like to use v.to.db to update the attribute table with some info on the vector features. BTW, how is sinuosity (v.to.db) calculated if several lines are grouped into one category?

Any suggestion is highly welcome! Thanks!

Best regards,
Johannes

Le 17 septembre 2017 15:16:02 GMT+02:00, Johannes Radinger <johannesradinger@gmail.com> a écrit :

Hi,

how can I merge multiple lines into one category based on some
attribute
information.
For example I have a line vector consisting of 10 lines and several
lines
belong to three different groups (lines belonging to the same group
share
the same value in a specific attribute column). Now I'd like to merge
them
(assign a common cats) and create an new attribute with the "group
value"
as new category (the table should then have 3 rows)? I think this
should be
easily possible, but I could not yet find the correct tool.

Try v.reclass.

Moritz

Thank you Moritz!

Of course, v.reclass does the job. I just didn’t see the column option…

Regarding the second (additional) part of this question: It seems that v.to.db works well to report line lengths on a category-base. However, sinuosity seems to be calculated based on features (i.e. feature ids). Thus, I only get reasonable results if a cat only consists of one feature. For connected lines that consist of more than one feature (lines) the sinuosity index is not correct. So, I probably need to loop over the cats, extract the lines that belong to one cat and build a polyline before calculating sinuosity.

/J

···

On Sun, Sep 17, 2017 at 3:53 PM, Moritz Lennert <mlennert@club.worldonline.be> wrote:

Le 17 septembre 2017 15:16:02 GMT+02:00, Johannes Radinger <johannesradinger@gmail.com> a écrit :

Hi,

how can I merge multiple lines into one category based on some
attribute
information.
For example I have a line vector consisting of 10 lines and several
lines
belong to three different groups (lines belonging to the same group
share
the same value in a specific attribute column). Now I’d like to merge
them
(assign a common cats) and create an new attribute with the “group
value”
as new category (the table should then have 3 rows)? I think this
should be
easily possible, but I could not yet find the correct tool.

Try v.reclass.

Moritz

On 17/09/17 18:48, Johannes Radinger wrote:

Thank you Moritz!

Of course, v.reclass does the job. I just didn't see the column option...

Regarding the second (additional) part of this question: It seems that v.to.db works well to report line lengths on a category-base. However, sinuosity seems to be calculated based on features (i.e. feature ids). Thus, I only get reasonable results if a cat only consists of one feature. For connected lines that consist of more than one feature (lines) the sinuosity index is not correct. So, I probably need to loop over the cats, extract the lines that belong to one cat and build a polyline before calculating sinuosity.

Please file a bug report on this so that someone might at least have a look at it. ISTR, that this kind of limitation was present for other indicators in v.to.db and is definitely worth thinking about.

Moritz

On 18/09/17 11:14, Moritz Lennert wrote:

On 17/09/17 18:48, Johannes Radinger wrote:

Thank you Moritz!

Of course, v.reclass does the job. I just didn't see the column option...

Regarding the second (additional) part of this question: It seems that
v.to.db works well to report line lengths on a category-base. However,
sinuosity seems to be calculated based on features (i.e. feature ids).
Thus, I only get reasonable results if a cat only consists of one
feature. For connected lines that consist of more than one feature
(lines) the sinuosity index is not correct. So, I probably need to loop
over the cats, extract the lines that belong to one cat and build a
polyline before calculating sinuosity.

Please file a bug report on this so that someone might at least have a
look at it. ISTR, that this kind of limitation was present for other
indicators in v.to.db and is definitely worth thinking about.

P.S. https://trac.osgeo.org/grass/ticket/3102

Moritz