[GRASSLIST:592] Re: Split a polyline?

Radim Blazek blazek at itc.it
Wed Jul 2 03:12:26 EDT 2003


On Tuesday 01 July 2003 17:31, Massimiliano Cannata wrote:
> Hello everybody,
> do you know if is there any fast way to divide all
> the vector of my layer in many part?
> I'd like to obtain a series of vector of
> predefined lenght (e.s. 100 meters long).
> Do you think it's possible? How?
> Thanks you all

In 5.1 something like (script not tested):

v.to.db map=line option=length col1=l

for LINE in `db.select -c sql="select cat,l from line"`
do
    CAT=`echo LINE | sed 's/|.*//'`
    L=`echo LINE | sed 's/.*|//'`
    
    S=0
    while [ $S -lt $L ]
    do
       E=`expr $S + 100`
       echo "L 1 $CAT $S $E" >> seg
       S=`expr $S + 100`
    done
done

cat seg | v.segment input=line output=segment

Is it fast or not?

Radim




More information about the grass-user mailing list