[GRASS-dev] [bug #2793] (grass) v.segment: side offset is ignored

Markus Neteler neteler at itc.it
Thu May 3 08:24:06 EDT 2007

On Fri, May 04, 2007 at 12:08:02AM +1200, Hamish wrote:
> > > Markus Neteler via RT wrote:
> > > > https://intevation.de/rt/webrt?serial_num=2793
> > > > 
> > > > Apparently Vect_point_on_line() lacks support for side offset.
> > > > Indeed, it doesn't even have such a parameter.
> > 
> > Hamish:
> > > if we know the slope of the line at the point (angle*), it is easy
> > > enough to calculate a point perpendicular to it (in the x,y plane)
> > > offset by a certain distance with a little trig.
> now functional in CVS. please test.


d.vect myrailroads disp=shape,dir
echo "P 1 1 5000 -100" | v.segment myrailroads out=myrailroads_segp2
d.vect myrailroads_segp2 col=blue
-> works (to the right of vector direction with negative side offset)

echo "L 1 1 400 5000 -100" | v.segment myrailroads out=myrailroads_segl2
d.vect myrailroads_segl2 disp=shape,dir
-> works (to the right of vector direction with negative side offset)

> Backport to 6.2 or comment out references to offset in the help page?

+1 for backport.
> > > shift offset to the left or right?
> I have set it to shift to the left as you go along the line, for little
> reason other than I had to pick something and that's the side of the
> road we drive on here. If there is a reason to have positive offsets
> shift to the right (e.g. v.lrs or vector topology side 1,2 conventions;
> Cartesian axes make +x go to the right; electro-magnetic interactions;
> other..) let me know and I'll swap it.

At least it should be consistent within GRASS.

> Untested on 3D points & lines. Right now it outputs in the xy plane, but
> full 3D points would be possible using Vect_point_on_line(...,slope);
> (probably reuse Lat/lon code for that!) but offset is only 1D right now.
> Vect_line_parallel() is only 2D AFAICT, so lines would require more
> work, but would be a cool feature to have. (but again with the 1D offset)


with vertical offset we could easily approximate powerlines and
such for trams in the city (cable over a street). On the other
hand, v.transform with z shift already does this.

> still open:
> > can anyone compose a nice example (x2) for the v.segment help page?


More information about the grass-dev mailing list