[GRASS-user] Merging connected stream lines

Hi list!

I couldn’t find an easy way to merge connected stream lines per network (stream output from r.watershed thinned and converted to vector). I’m not even sure if stream lines with tributaries can be merged into one feature. v.build.polylines merges multiple continuous lines, but it starts a new line at a confluence. If merging multiple lines with shared nodes is topologically impossible, what would be the best way to select all connected line features or assign the same category to those lines?

Any suggestions are welcome!

Thanks!
Huidae

Hi,

Did you try:

https://grass.osgeo.org/grass72/manuals/v.net.components.html

That might give you a common attribute for all connected lines in your network…

Cheers

Stefan

···

Hi list!

I couldn’t find an easy way to merge connected stream lines per network (stream output from r.watershed thinned and converted to vector). I’m not even sure if stream lines with tributaries can be merged into one feature. v.build.polylines merges multiple continuous lines, but it starts a new line at a confluence. If merging multiple lines with shared nodes is topologically impossible, what would be the best way to select all connected line features or assign the same category to those lines?

Any suggestions are welcome!

Thanks!

Huidae

On Thu, Oct 26, 2017 at 9:58 AM, Stefan Blumentrath
<Stefan.Blumentrath@nina.no> wrote:

Hi,

Did you try:

https://grass.osgeo.org/grass72/manuals/v.net.components.html

That might give you a common attribute for all connected lines in your
network…

I just tried that with NC but:

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=roadsmajor
output=roadsmajor_components method=strong
Building graph...
Registering arcs...
100%
Flattening the graph...
ERROR: GngFlatten error

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=railroads
output=railroads_components method=strong
Building graph...
Registering arcs...
100%
Flattening the graph...
ERROR: GngFlatten error

Does the network need any special treatment?

Markus

On Thu, Oct 26, 2017 at 5:02 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Thu, Oct 26, 2017 at 9:58 AM, Stefan Blumentrath
<Stefan.Blumentrath@nina.no> wrote:

Hi,

Did you try:

https://grass.osgeo.org/grass72/manuals/v.net.components.html

That might give you a common attribute for all connected lines in your
network…

I just tried that with NC but:

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=roadsmajor
output=roadsmajor_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=railroads
output=railroads_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

Does the network need any special treatment?

I can not reproduce these errors. Please update your local copy:

make distclean

svn --no-ignore status

svn up

configure

make

Markus M

Markus


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Actually, I’m getting the same error as Markus in the NC dataset. I recently discleaned and rebuilt the latest SVN.

Huidae

···

On Thu, Oct 26, 2017 at 4:14 PM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Thu, Oct 26, 2017 at 5:02 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Thu, Oct 26, 2017 at 9:58 AM, Stefan Blumentrath
<Stefan.Blumentrath@nina.no> wrote:

Hi,

Did you try:

https://grass.osgeo.org/grass72/manuals/v.net.components.html

That might give you a common attribute for all connected lines in your
network…

I just tried that with NC but:

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=roadsmajor
output=roadsmajor_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=railroads
output=railroads_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

Does the network need any special treatment?

I can not reproduce these errors. Please update your local copy:

make distclean

svn --no-ignore status

svn up

configure

make

Markus M

Markus


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Hi,

It works fine for me:

GRASS 7.2.1svn (nc_spm_08_grass7): > v.net.components input=roadsmajor output=roadsmajor_components method=strong

Building graph…

Registering arcs…

100%

Flattening the graph…

Graph was built

Computing strongly connected components…

Writing output…

100%

Building topology for vector map

roadsmajor_components@stefan.blumentrath

Registering primitives…

355 primitives registered

55717 vertices registered

Building areas…

100%

0 areas built

0 isles built

Attaching islands…

Attaching centroids…

100%

Number of nodes: 266

Number of primitives: 355

Number of points: 0

Number of lines: 355

Number of boundaries: 0

Number of centroids: 0

Number of areas: 0

Number of isles: 0

v.net.components complete. Found 7 components.

On:

GRASS 7.2.1svn (nc_spm_08_grass7): > g.version -g

version=7.2.1svn

date=2017

revision=r70326

build_date=2017-01-10

build_platform=x86_64-pc-linux-gnu

build_off_t_size=8

Cheers

Stefan

···

Actually, I’m getting the same error as Markus in the NC dataset. I recently discleaned and rebuilt the latest SVN.

Huidae

On Thu, Oct 26, 2017 at 4:14 PM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Thu, Oct 26, 2017 at 5:02 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Thu, Oct 26, 2017 at 9:58 AM, Stefan Blumentrath
<Stefan.Blumentrath@nina.no> wrote:

Hi,

Did you try:

https://grass.osgeo.org/grass72/manuals/v.net.components.html

That might give you a common attribute for all connected lines in your
network…

I just tried that with NC but:

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=roadsmajor
output=roadsmajor_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=railroads
output=railroads_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

Does the network need any special treatment?

I can not reproduce these errors. Please update your local copy:

make distclean

svn --no-ignore status

svn up

configure

make

Markus M

Markus


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

On Fri, Oct 27, 2017 at 12:52 PM, Huidae Cho <grass4u@gmail.com> wrote:

Actually, I’m getting the same error as Markus in the NC dataset. I recently discleaned and rebuilt the latest SVN.

In trunk, this bug appeared with r71267 and was fixed with r71477.

In relbr72, this bug appeared with r71268 and was fixed with r71478.

Please check your revision.

Markus M

Huidae

On Thu, Oct 26, 2017 at 4:14 PM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Thu, Oct 26, 2017 at 5:02 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Thu, Oct 26, 2017 at 9:58 AM, Stefan Blumentrath
<Stefan.Blumentrath@nina.no> wrote:

Hi,

Did you try:

https://grass.osgeo.org/grass72/manuals/v.net.components.html

That might give you a common attribute for all connected lines in your
network…

I just tried that with NC but:

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=roadsmajor
output=roadsmajor_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=railroads
output=railroads_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

Does the network need any special treatment?

I can not reproduce these errors. Please update your local copy:
make distclean
svn --no-ignore status
svn up
configure
make

Markus M

Markus


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

I’ll check my revision. Thanks for the info.

Also, I found that thinning the stream raster from r.watershed and converting it to vector doesn’t really work well. When there are clumps of raster cells, flow directions get messed up. I tried your r.stream.extract to extract stream lines and its output makes much more sense. It would be great if this module also outputs unique stream “network” numbers.

Thanks.

Huidae

···

On Fri, Oct 27, 2017 at 8:14 AM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Fri, Oct 27, 2017 at 12:52 PM, Huidae Cho <grass4u@gmail.com> wrote:

Actually, I’m getting the same error as Markus in the NC dataset. I recently discleaned and rebuilt the latest SVN.

In trunk, this bug appeared with r71267 and was fixed with r71477.

In relbr72, this bug appeared with r71268 and was fixed with r71478.

Please check your revision.

Markus M

Huidae

On Thu, Oct 26, 2017 at 4:14 PM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Thu, Oct 26, 2017 at 5:02 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Thu, Oct 26, 2017 at 9:58 AM, Stefan Blumentrath
<Stefan.Blumentrath@nina.no> wrote:

Hi,

Did you try:

https://grass.osgeo.org/grass72/manuals/v.net.components.html

That might give you a common attribute for all connected lines in your
network…

I just tried that with NC but:

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=roadsmajor
output=roadsmajor_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=railroads
output=railroads_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

Does the network need any special treatment?

I can not reproduce these errors. Please update your local copy:
make distclean
svn --no-ignore status
svn up
configure
make

Markus M

Markus


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

Cool, just updated my repository and it’s now working. I’ll have to see the output to understand what I can do with it.

Thanks.

Huidae

···

On Fri, Oct 27, 2017 at 8:38 AM, Huidae Cho <grass4u@gmail.com> wrote:

I’ll check my revision. Thanks for the info.

Also, I found that thinning the stream raster from r.watershed and converting it to vector doesn’t really work well. When there are clumps of raster cells, flow directions get messed up. I tried your r.stream.extract to extract stream lines and its output makes much more sense. It would be great if this module also outputs unique stream “network” numbers.

Thanks.

Huidae

On Fri, Oct 27, 2017 at 8:14 AM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Fri, Oct 27, 2017 at 12:52 PM, Huidae Cho <grass4u@gmail.com> wrote:

Actually, I’m getting the same error as Markus in the NC dataset. I recently discleaned and rebuilt the latest SVN.

In trunk, this bug appeared with r71267 and was fixed with r71477.

In relbr72, this bug appeared with r71268 and was fixed with r71478.

Please check your revision.

Markus M

Huidae

On Thu, Oct 26, 2017 at 4:14 PM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Thu, Oct 26, 2017 at 5:02 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Thu, Oct 26, 2017 at 9:58 AM, Stefan Blumentrath
<Stefan.Blumentrath@nina.no> wrote:

Hi,

Did you try:

https://grass.osgeo.org/grass72/manuals/v.net.components.html

That might give you a common attribute for all connected lines in your
network…

I just tried that with NC but:

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=roadsmajor
output=roadsmajor_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=railroads
output=railroads_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

Does the network need any special treatment?

I can not reproduce these errors. Please update your local copy:
make distclean
svn --no-ignore status
svn up
configure
make

Markus M

Markus


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

v.net.componentsOn Fri, Oct 27, 2017 at 2:14 PM, Markus Metz
<markus.metz.giswork@gmail.com> wrote:

On Fri, Oct 27, 2017 at 12:52 PM, Huidae Cho <grass4u@gmail.com> wrote:

Actually, I'm getting the same error as Markus in the NC dataset. I
recently discleaned and rebuilt the latest SVN.

In trunk, this bug appeared with r71267 and was fixed with r71477.
In relbr72, this bug appeared with r71268 and was fixed with r71478.

Please check your revision.

Yeah, my local copy was outdated (... /me travelling :slight_smile: - all fine
with v.net.components! Sorry for the noise.

thanks
markusN

On Fri, Oct 27, 2017 at 2:38 PM, Huidae Cho <grass4u@gmail.com> wrote:

[…] I tried your r.stream.extract to extract stream lines and its output makes much more sense. It would be great if this module also outputs unique stream “network” numbers.

Unique stream network numbers are added as new attribute “network” in trunk r71599.

Markus M

Thanks.
Huidae

On Fri, Oct 27, 2017 at 8:14 AM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Fri, Oct 27, 2017 at 12:52 PM, Huidae Cho <grass4u@gmail.com> wrote:

Actually, I’m getting the same error as Markus in the NC dataset. I recently discleaned and rebuilt the latest SVN.

In trunk, this bug appeared with r71267 and was fixed with r71477.
In relbr72, this bug appeared with r71268 and was fixed with r71478.

Please check your revision.

Markus M

Huidae

On Thu, Oct 26, 2017 at 4:14 PM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Thu, Oct 26, 2017 at 5:02 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Thu, Oct 26, 2017 at 9:58 AM, Stefan Blumentrath
<Stefan.Blumentrath@nina.no> wrote:

Hi,

Did you try:

https://grass.osgeo.org/grass72/manuals/v.net.components.html

That might give you a common attribute for all connected lines in your
network…

I just tried that with NC but:

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=roadsmajor
output=roadsmajor_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=railroads
output=railroads_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

Does the network need any special treatment?

I can not reproduce these errors. Please update your local copy:
make distclean
svn --no-ignore status
svn up
configure
make

Markus M

Markus


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

It’s working great! Thanks for the quick implementation. It will help a lot!

Huidae

···

On Fri, Oct 27, 2017 at 3:58 PM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Fri, Oct 27, 2017 at 2:38 PM, Huidae Cho <grass4u@gmail.com> wrote:

[…] I tried your r.stream.extract to extract stream lines and its output makes much more sense. It would be great if this module also outputs unique stream “network” numbers.

Unique stream network numbers are added as new attribute “network” in trunk r71599.

Markus M

Thanks.
Huidae

On Fri, Oct 27, 2017 at 8:14 AM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Fri, Oct 27, 2017 at 12:52 PM, Huidae Cho <grass4u@gmail.com> wrote:

Actually, I’m getting the same error as Markus in the NC dataset. I recently discleaned and rebuilt the latest SVN.

In trunk, this bug appeared with r71267 and was fixed with r71477.
In relbr72, this bug appeared with r71268 and was fixed with r71478.

Please check your revision.

Markus M

Huidae

On Thu, Oct 26, 2017 at 4:14 PM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Thu, Oct 26, 2017 at 5:02 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Thu, Oct 26, 2017 at 9:58 AM, Stefan Blumentrath
<Stefan.Blumentrath@nina.no> wrote:

Hi,

Did you try:

https://grass.osgeo.org/grass72/manuals/v.net.components.html

That might give you a common attribute for all connected lines in your
network…

I just tried that with NC but:

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=roadsmajor
output=roadsmajor_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=railroads
output=railroads_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

Does the network need any special treatment?

I can not reproduce these errors. Please update your local copy:
make distclean
svn --no-ignore status
svn up
configure
make

Markus M

Markus


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

BTW, let me understand weakly vs strongly connected components generated by v.net.components.

Strongly connected: All paths between nodes u and v should have the same direction.

Weakly connected: Only requires “connections” between nodes u and v, and their directions don’t matter.

If my understanding is correct, a stream vector map generated by thinning and converting the stream raster map (flow directions not guaranteed) to vector would only be weakly connected.

The stream vector output from r.streams.extract would be both strongly and weakly connected because it honors flow directions.

Please let me know if I’m mistaken.

Thanks.

Huidae

···

On Sat, Oct 28, 2017 at 9:06 AM, Huidae Cho <grass4u@gmail.com> wrote:

It’s working great! Thanks for the quick implementation. It will help a lot!

Huidae

On Fri, Oct 27, 2017 at 3:58 PM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Fri, Oct 27, 2017 at 2:38 PM, Huidae Cho <grass4u@gmail.com> wrote:

[…] I tried your r.stream.extract to extract stream lines and its output makes much more sense. It would be great if this module also outputs unique stream “network” numbers.

Unique stream network numbers are added as new attribute “network” in trunk r71599.

Markus M

Thanks.
Huidae

On Fri, Oct 27, 2017 at 8:14 AM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Fri, Oct 27, 2017 at 12:52 PM, Huidae Cho <grass4u@gmail.com> wrote:

Actually, I’m getting the same error as Markus in the NC dataset. I recently discleaned and rebuilt the latest SVN.

In trunk, this bug appeared with r71267 and was fixed with r71477.
In relbr72, this bug appeared with r71268 and was fixed with r71478.

Please check your revision.

Markus M

Huidae

On Thu, Oct 26, 2017 at 4:14 PM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Thu, Oct 26, 2017 at 5:02 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Thu, Oct 26, 2017 at 9:58 AM, Stefan Blumentrath
<Stefan.Blumentrath@nina.no> wrote:

Hi,

Did you try:

https://grass.osgeo.org/grass72/manuals/v.net.components.html

That might give you a common attribute for all connected lines in your
network…

I just tried that with NC but:

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=roadsmajor
output=roadsmajor_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=railroads
output=railroads_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

Does the network need any special treatment?

I can not reproduce these errors. Please update your local copy:
make distclean
svn --no-ignore status
svn up
configure
make

Markus M

Markus


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

On Sat, Oct 28, 2017 at 3:18 PM, Huidae Cho <grass4u@gmail.com> wrote:

BTW, let me understand weakly vs strongly connected components generated by v.net.components.

Strongly connected: All paths between nodes u and v should have the same direction.

From the manual:
“there are directed paths from u to v and from v to u”

You can create directed graphs by assigning costs according to line direction with the arc_column and arc_backward_column options. The forward or backward direction of a line can be closed by setting costs to -1.

By default, (no cost columns given), line lengths are used as costs, ignoring line direction because 1) line direction can be arbitrary, 2) typically lines can be traversed in both directions.

Therefore, method=strong only makes sense if both arc_column and arc_backward_column are given and if some lines are closed in one direction. Otherwise, strong and weak will give the same results.

Weakly connected: Only requires “connections” between nodes u and v, and their directions don’t matter.

To be precise, u must be reachable from v or v must be reachable from u.

If my understanding is correct, a stream vector map generated by thinning and converting the stream raster map (flow directions not guaranteed) to vector would only be weakly connected.

The stream vector output from r.streams.extract would be both strongly and weakly connected because it honors flow directions.

Different stream networks are always different components. If you use arc_backward_column and close backward traversal, each stream network is again broken up into various strongly connected components.

If you use r.thin + r.to.vect + arc_backward_column, a single stream network might even be broken up into several weakly connected components.

HTH,

Markus M

Please let me know if I’m mistaken.

Thanks.
Huidae

On Sat, Oct 28, 2017 at 9:06 AM, Huidae Cho <grass4u@gmail.com> wrote:

It’s working great! Thanks for the quick implementation. It will help a lot!

Huidae

On Fri, Oct 27, 2017 at 3:58 PM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Fri, Oct 27, 2017 at 2:38 PM, Huidae Cho <grass4u@gmail.com> wrote:

[…] I tried your r.stream.extract to extract stream lines and its output makes much more sense. It would be great if this module also outputs unique stream “network” numbers.

Unique stream network numbers are added as new attribute “network” in trunk r71599.

Markus M

Thanks.
Huidae

On Fri, Oct 27, 2017 at 8:14 AM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Fri, Oct 27, 2017 at 12:52 PM, Huidae Cho <grass4u@gmail.com> wrote:

Actually, I’m getting the same error as Markus in the NC dataset. I recently discleaned and rebuilt the latest SVN.

In trunk, this bug appeared with r71267 and was fixed with r71477.
In relbr72, this bug appeared with r71268 and was fixed with r71478.

Please check your revision.

Markus M

Huidae

On Thu, Oct 26, 2017 at 4:14 PM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Thu, Oct 26, 2017 at 5:02 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Thu, Oct 26, 2017 at 9:58 AM, Stefan Blumentrath
<Stefan.Blumentrath@nina.no> wrote:

Hi,

Did you try:

https://grass.osgeo.org/grass72/manuals/v.net.components.html

That might give you a common attribute for all connected lines in your
network…

I just tried that with NC but:

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=roadsmajor
output=roadsmajor_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=railroads
output=railroads_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

Does the network need any special treatment?

I can not reproduce these errors. Please update your local copy:
make distclean
svn --no-ignore status
svn up
configure
make

Markus M

Markus


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

I studied strongly vs. weakly connected components little bit. So…

  1. As long as there are positive costs in both arc_column and arc_backward_column between nodes, they are in the same strongly connected components.
  2. If any of arc_column and arc_backward_column is positive between nodes, they are in the same weakly connected components.
  3. If both columns are negative between two nodes, they are disconnected even if there is a line between them.
  4. Because of point 3 above, using and not using both columns may result in different weakly connected components. No connected lines vs. no traversal using a negative cost with connected lines.

Hope my understanding is correct.

Thank you.
Huidae

···

On Sun, Oct 29, 2017 at 12:07 PM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Sat, Oct 28, 2017 at 3:18 PM, Huidae Cho <grass4u@gmail.com> wrote:

BTW, let me understand weakly vs strongly connected components generated by v.net.components.

Strongly connected: All paths between nodes u and v should have the same direction.

From the manual:
“there are directed paths from u to v and from v to u”

You can create directed graphs by assigning costs according to line direction with the arc_column and arc_backward_column options. The forward or backward direction of a line can be closed by setting costs to -1.

By default, (no cost columns given), line lengths are used as costs, ignoring line direction because 1) line direction can be arbitrary, 2) typically lines can be traversed in both directions.

Therefore, method=strong only makes sense if both arc_column and arc_backward_column are given and if some lines are closed in one direction. Otherwise, strong and weak will give the same results.

Weakly connected: Only requires “connections” between nodes u and v, and their directions don’t matter.

To be precise, u must be reachable from v or v must be reachable from u.

If my understanding is correct, a stream vector map generated by thinning and converting the stream raster map (flow directions not guaranteed) to vector would only be weakly connected.

The stream vector output from r.streams.extract would be both strongly and weakly connected because it honors flow directions.

Different stream networks are always different components. If you use arc_backward_column and close backward traversal, each stream network is again broken up into various strongly connected components.

If you use r.thin + r.to.vect + arc_backward_column, a single stream network might even be broken up into several weakly connected components.

HTH,

Markus M

Please let me know if I’m mistaken.

Thanks.
Huidae

On Sat, Oct 28, 2017 at 9:06 AM, Huidae Cho <grass4u@gmail.com> wrote:

It’s working great! Thanks for the quick implementation. It will help a lot!

Huidae

On Fri, Oct 27, 2017 at 3:58 PM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Fri, Oct 27, 2017 at 2:38 PM, Huidae Cho <grass4u@gmail.com> wrote:

[…] I tried your r.stream.extract to extract stream lines and its output makes much more sense. It would be great if this module also outputs unique stream “network” numbers.

Unique stream network numbers are added as new attribute “network” in trunk r71599.

Markus M

Thanks.
Huidae

On Fri, Oct 27, 2017 at 8:14 AM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Fri, Oct 27, 2017 at 12:52 PM, Huidae Cho <grass4u@gmail.com> wrote:

Actually, I’m getting the same error as Markus in the NC dataset. I recently discleaned and rebuilt the latest SVN.

In trunk, this bug appeared with r71267 and was fixed with r71477.
In relbr72, this bug appeared with r71268 and was fixed with r71478.

Please check your revision.

Markus M

Huidae

On Thu, Oct 26, 2017 at 4:14 PM, Markus Metz <markus.metz.giswork@gmail.com> wrote:

On Thu, Oct 26, 2017 at 5:02 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Thu, Oct 26, 2017 at 9:58 AM, Stefan Blumentrath
<Stefan.Blumentrath@nina.no> wrote:

Hi,

Did you try:

https://grass.osgeo.org/grass72/manuals/v.net.components.html

That might give you a common attribute for all connected lines in your
network…

I just tried that with NC but:

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=roadsmajor
output=roadsmajor_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

GRASS 7.3.svn (nc_spm_08_grass7):~ > v.net.components input=railroads
output=railroads_components method=strong
Building graph…
Registering arcs…
100%
Flattening the graph…
ERROR: GngFlatten error

Does the network need any special treatment?

I can not reproduce these errors. Please update your local copy:
make distclean
svn --no-ignore status
svn up
configure
make

Markus M

Markus


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user