# [GRASS-user] Recommended v.select relate matrix?

Moritz Lennert mlennert at club.worldonline.be
Mon Jul 24 02:01:28 PDT 2017

```On 24/07/17 09:55, Jeshua Lacock wrote:
>
>> On Jul 23, 2017, at 3:47 AM, Moritz Lennert <mlennert at club.worldonline.be> wrote:
>>
>> On 22/07/17 23:58, Jeshua Lacock wrote:
>>>> On Jul 22, 2017, at 4:47 AM, Moritz Lennert <mlennert at club.worldonline.be <mailto:mlennert at club.worldonline.be>> wrote:
>>>>
>>>> Actually I think that showing us the example with all lines will make it easier to think about solutions.
>>> Hi Moritz,
>>> The purple line can select lines that just cross it like the red line shown in the attached image.
>>
>> But you said 'crosses' is not sufficient. Could you explain why ?
>
> Equals, crosses and intersects will select the line shown in red - I only want to select the lines that are spatially similar or coincidental; the orange lines from the purple lines.
>
>> Again, without a view of the lines you do not want to select, I'm not sure I understand the issue.
>
> In that section, the only line that is a problem is the line shown in red. As you can see, the orange and purple lines are have similar paths, but the red line is only crossed by the purple line. It doesn’t follow the purple line…

If that line is the only type of problem, then a buffer + a 'within'
operation should do the trick, no ?

On 24/07/17 10:04, Jeshua Lacock wrote:
>
>> On Jul 23, 2017, at 7:14 AM, Stuart Edwards <sedwards2 at cinci.rr.com>
wrote:
>> If there are several lines that meet this first test perhaps
calculating the distance between each of them and the target (node by
node) and selecting the one that results in the minimum cumulative distance?
>
> Is there a way in grass to select lines based on distances, or are
you speaking of a possibly custom solution?

v.distance does provide the possibility to calculate distances between
lines. It also allows to retrieve the angle of the line at the closest
point. Combined with v.to.db on your selecting line to get the angle of
that line you could then compare the two angles. However, the two
modules do not seem to calculate the angle in the same way, so you might
have to transform angles to be able to compare.

As Stuart already indicated, you might want to split the lines in
sufficiently small segments.

Moritz

```