[GRASS-user] perpendicular segments to a line

Maciej Sieczka tutey at o2.pl
Mon Oct 30 11:19:17 EST 2006

ivan marchesini wrote:
> Dear all,
> does someone know if there's a simple way to create perpendicolar
> segments to a lines (equispaced along this line)???
> like this...
> |   |   |    |    |
> -------------------
> |   |   |    |    |

How about this:

0. Make sure you input line has categories.

1. Create close parallel lines on the sides of your input line (choose
the distance that suits you):
v.parallel input=center_line output=left distance=0.00001
v.parallel input=center_line output=right distance=-0.00001

2. Calculate the offsets as needed, then use them to create points on
desired locations, along the lines on the 2 sides of your input line:
cat offsets | v.segment input=right output=right_seg
cat offsets | v.segment input=left output=left_seg

3. Connect the closest points:
v.distance from=left_seg to=right_seg from_type=point to_type=point
output=shorties dmax=-1

4. Patch "shorties" with your input (v.patch)

5. Break at crossings (v.clean type=line tool=break)

You obtain a topologically clean line with crossbars.


More information about the grass-user mailing list