[GRASS-user] v.dissolve for lines?

Maris Nartiss maris.gis at gmail.com
Wed Oct 20 03:54:54 EDT 2010


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 <micha at 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 at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>


More information about the grass-user mailing list