Re: [GRASS-user] v.dissolve for lines?

2010-11-11 Thread Bryan Keith
 On 11/05/2010 09:59 PM, Bryan Keith wrote:
 On 10/19/2010 11:17 PM, Bryan Keith wrote:

 Hello,

 I have a vector line file that has lots of two-vertex lines.  Many of
 these two-vertex lines share endpoints and really just make parts of
 one
 longer line.  I'd like to dissolve these lines into one line when they
 have the same end point.  It looks like v.dissolve only works for
 areas.
 Is there somewhere else I should be looking?  Thank you.



 Did you have a look at v.build.polylines ?
 Additional note: line vectors have a direction. Two line segments with
 an equivalent node (end point) will *not* connect if they are in
 opposite directions. In this case you can try the v.edit tool=flip
 option (on those segments only)

 Thank you for the response.  I finally got around to looking at this
 today.  I made a simple example and tested with v.build.polylines, and
 it
 works great.  Thank you.

 However, it turns out that I have many duplicate lines in my dataset.  I
 created a simple example where there are duplicate lines, and
 v.build.polylines doesn't work in that case.  What do I need to look at
 to
 get rid of duplicate lines?



 v.clean tool=rmdupl
 Might do it if the lines exactly overlap.

Yes, that worked in my case.  Thanks so much, Micha!

Bryan

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


Re: [GRASS-user] v.dissolve for lines?

2010-11-05 Thread Bryan Keith
 On 10/19/2010 11:17 PM, Bryan Keith wrote:
 Hello,

 I have a vector line file that has lots of two-vertex lines.  Many of
 these two-vertex lines share endpoints and really just make parts of one
 longer line.  I'd like to dissolve these lines into one line when they
 have the same end point.  It looks like v.dissolve only works for areas.
 Is there somewhere else I should be looking?  Thank you.


 Did you have a look at v.build.polylines ?
 Additional note: line vectors have a direction. Two line segments with
 an equivalent node (end point) will *not* connect if they are in
 opposite directions. In this case you can try the v.edit tool=flip
 option (on those segments only)

Thank you for the response.  I finally got around to looking at this
today.  I made a simple example and tested with v.build.polylines, and it
works great.  Thank you.

However, it turns out that I have many duplicate lines in my dataset.  I
created a simple example where there are duplicate lines, and
v.build.polylines doesn't work in that case.  What do I need to look at to
get rid of duplicate lines?

Bryan

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

 This mail was received via Mail-SeCure System.





 --
 Micha Silver
 Arava Development Co. +972-52-3665918
 http://www.surfaces.co.il





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


Re: [GRASS-user] v.dissolve for lines?

2010-11-05 Thread Micha Silver

On 11/05/2010 09:59 PM, Bryan Keith wrote:

On 10/19/2010 11:17 PM, Bryan Keith wrote:
 

Hello,

I have a vector line file that has lots of two-vertex lines.  Many of
these two-vertex lines share endpoints and really just make parts of one
longer line.  I'd like to dissolve these lines into one line when they
have the same end point.  It looks like v.dissolve only works for areas.
Is there somewhere else I should be looking?  Thank you.


   

Did you have a look at v.build.polylines ?
Additional note: line vectors have a direction. Two line segments with
an equivalent node (end point) will *not* connect if they are in
opposite directions. In this case you can try the v.edit tool=flip
option (on those segments only)
 

Thank you for the response.  I finally got around to looking at this
today.  I made a simple example and tested with v.build.polylines, and it
works great.  Thank you.

However, it turns out that I have many duplicate lines in my dataset.  I
created a simple example where there are duplicate lines, and
v.build.polylines doesn't work in that case.  What do I need to look at to
get rid of duplicate lines?

   


v.clean tool=rmdupl
Might do it if the lines exactly overlap.


Bryan

   

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


Re: [GRASS-user] v.dissolve for lines?

2010-10-20 Thread Markus Metz
Micha Silver wrote:
 Bryan Keith wrote:

 Hello,

 I have a vector line file that has lots of two-vertex lines.  Many of
 these two-vertex lines share endpoints and really just make parts of one
 longer line.  I'd like to dissolve these lines into one line when they
 have the same end point.  It looks like v.dissolve only works for areas.
 Is there somewhere else I should be looking?  Thank you.



 Did you have a look at v.build.polylines ?
 Additional note: line vectors have a direction. Two line segments with an
 equivalent node (end point) will *not* connect if they are in opposite
 directions.

Each line has two nodes, one at the start and one at the end. If at
the end of one line any other line is starting or ending, this other
line is added to the first line, reversing the direction if necessary.
IOW, two lines with a common node will indeed connect, and the
direction of one line may need to be reversed (done automatically).
Very simple to test by digitizing a simple test vector.

In this case you can try the v.edit tool=flip option (on those
 segments only)

Should not be needed as pre-processing step for v.build.polylines.


Markus M
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


Re: [GRASS-user] v.dissolve for lines?

2010-10-20 Thread Micha Silver

 On 20/10/2010 08:36, Markus Metz wrote:

Micha Silver wrote:

Bryan Keith wrote:

Hello,

I have a vector line file that has lots of two-vertex lines.  Many of
these two-vertex lines share endpoints and really just make parts of one
longer line.  I'd like to dissolve these lines into one line when they
have the same end point.  It looks like v.dissolve only works for areas.
Is there somewhere else I should be looking?  Thank you.



Did you have a look at v.build.polylines ?
Additional note: line vectors have a direction. Two line segments with an
equivalent node (end point) will *not* connect if they are in opposite
directions.

Each line has two nodes, one at the start and one at the end. If at
the end of one line any other line is starting or ending, this other
line is added to the first line, reversing the direction if necessary.
IOW, two lines with a common node will indeed connect, and the
direction of one line may need to be reversed (done automatically).
Very simple to test by digitizing a simple test vector.


Heh, thanks for the correction!
Was this always the case? I seem to remember not be able to 
merge lines unless they were connected in the same direction.
How does the line reversal work? That is, Which of the two 
line segments is chosen be get reversed?

Regards,
Micha


In this case you can try the v.edit tool=flip option (on those

segments only)

Should not be needed as pre-processing step for v.build.polylines.


Markus M

This mail was received via Mail-SeCure System.





--
Micha Silver
http://www.surfaces.co.il/
Arava Development Co.  +972-52-3665918

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


Re: [GRASS-user] v.dissolve for lines?

2010-10-20 Thread Maris Nartiss
If You have lines with wrong direction or segment order, You can try
to run my v.reorder_line_segments tool.[1] It will try to reorder
same CAT line segments to be in increasing order. It also reverses
line segments to be in order from start to end. It will work only for
simple, stright lines and will go nuts on circular featrues etc, still
sometimes it's faster than doing manual work.

Current version will stop if line contains crossection, still that
check can be removed. I introduced it only because module entered an
endless loop if multiline looped back to itself. Code is unfinished,
as I was not able to figure out how to solve non-trivial cases and
thus cleaned my data by hand.

It's tested on GRASS 7. It requires ctypes.

If You need aditional help, drop a note.
Maris.

1. 
http://www.gisnet.lv/trac/gisnet/browser/gisnettools/v.reorder_line_segments.py


2010/10/20, Micha Silver mi...@arava.co.il:
   On 20/10/2010 08:36, Markus Metz wrote:
 Micha Silver wrote:
 Bryan Keith wrote:
 Hello,

 I have a vector line file that has lots of two-vertex lines.  Many of
 these two-vertex lines share endpoints and really just make parts of one
 longer line.  I'd like to dissolve these lines into one line when they
 have the same end point.  It looks like v.dissolve only works for areas.
 Is there somewhere else I should be looking?  Thank you.


 Did you have a look at v.build.polylines ?
 Additional note: line vectors have a direction. Two line segments with an
 equivalent node (end point) will *not* connect if they are in opposite
 directions.
 Each line has two nodes, one at the start and one at the end. If at
 the end of one line any other line is starting or ending, this other
 line is added to the first line, reversing the direction if necessary.
 IOW, two lines with a common node will indeed connect, and the
 direction of one line may need to be reversed (done automatically).
 Very simple to test by digitizing a simple test vector.

 Heh, thanks for the correction!
 Was this always the case? I seem to remember not be able to
 merge lines unless they were connected in the same direction.
 How does the line reversal work? That is, Which of the two
 line segments is chosen be get reversed?
 Regards,
 Micha

 In this case you can try the v.edit tool=flip option (on those
 segments only)
 Should not be needed as pre-processing step for v.build.polylines.


 Markus M

 This mail was received via Mail-SeCure System.




 --
 Micha Silver
 http://www.surfaces.co.il/
 Arava Development Co.  +972-52-3665918

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

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


Re: [GRASS-user] v.dissolve for lines?

2010-10-20 Thread Markus Metz
Micha Silver wrote:
  On 20/10/2010 08:36, Markus Metz wrote:

 Micha Silver wrote:

 Bryan Keith wrote:

 Hello,

 I have a vector line file that has lots of two-vertex lines.  Many of
 these two-vertex lines share endpoints and really just make parts of one
 longer line.  I'd like to dissolve these lines into one line when they
 have the same end point.  It looks like v.dissolve only works for areas.
 Is there somewhere else I should be looking?  Thank you.


 Did you have a look at v.build.polylines ?
 Additional note: line vectors have a direction. Two line segments with an
 equivalent node (end point) will *not* connect if they are in opposite
 directions.

 Each line has two nodes, one at the start and one at the end. If at
 the end of one line any other line is starting or ending, this other
 line is added to the first line, reversing the direction if necessary.
 IOW, two lines with a common node will indeed connect, and the
 direction of one line may need to be reversed (done automatically).
 Very simple to test by digitizing a simple test vector.

 Heh, thanks for the correction!
 Was this always the case? I seem to remember not be able to merge lines
 unless they were connected in the same direction.
 How does the line reversal work? That is, Which of the two line segments is
 chosen be get reversed?

v.build.polyline works as follows:
it picks a line and from its start node, walks back as long as exactly
one other line is connected to this node. Line directions are reversed
as required, i.e. it does not matter if the next line is connected to
the current node by its start or end node.

Once the start line of a polyline is identified, it walks forward and
adds all vertices (in reverse order if needed) of connected lines to
the start line, i.e. the start line and connecting lines are reversed
as needed. That is, if a line is reversed depends on what node is
initially picked for building polylines.

If the direction of lines is important (it's not for boundaries to
build areas), you have to manually change line directions with either
v.edit or the wxdigitizer or the tool by Maris.

Markus M

 Regards,
 Micha

 In this case you can try the v.edit tool=flip option (on those

 segments only)

 Should not be needed as pre-processing step for v.build.polylines.


 Markus M

 This mail was received via Mail-SeCure System.




 --
 Micha Silver
 http://www.surfaces.co.il/
 Arava Development Co.  +972-52-3665918


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


[GRASS-user] v.dissolve for lines?

2010-10-19 Thread Bryan Keith
Hello,

I have a vector line file that has lots of two-vertex lines.  Many of
these two-vertex lines share endpoints and really just make parts of one
longer line.  I'd like to dissolve these lines into one line when they
have the same end point.  It looks like v.dissolve only works for areas. 
Is there somewhere else I should be looking?  Thank you.

Bryan

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


Re: [GRASS-user] v.dissolve for lines?

2010-10-19 Thread Micha Silver

On 10/19/2010 11:17 PM, Bryan Keith wrote:

Hello,

I have a vector line file that has lots of two-vertex lines.  Many of
these two-vertex lines share endpoints and really just make parts of one
longer line.  I'd like to dissolve these lines into one line when they
have the same end point.  It looks like v.dissolve only works for areas.
Is there somewhere else I should be looking?  Thank you.

   

Did you have a look at v.build.polylines ?
Additional note: line vectors have a direction. Two line segments with 
an equivalent node (end point) will *not* connect if they are in 
opposite directions. In this case you can try the v.edit tool=flip 
option (on those segments only)



Bryan

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

This mail was received via Mail-SeCure System.


   



--
Micha Silver
Arava Development Co. +972-52-3665918
http://www.surfaces.co.il


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