Hi everybody,<br>in precedent mails , I ask for split polyline vector with a point vector to create a new polyline vector. <br>I wrote a little shell bash to resolve the problem (this script is not yet finish). Be tolerant, I'm a newbie in GRASS and linux script; there are no warning (no verification of the input layer...) in the script, I've not finished the end. I post you this script to have any suggestion of the way I choose to solve my problem, so take a look and If you have any ideas to improve my script don't hesitate to post me a message
<br><br><br>#!/bin/bash<br>#launch this script on GRASS <br>#job of this script: split polylines with a vector of points<br>#and create a new polylines vector<br>#use of GRASS Add on: v.out.ascii.db<br>mkdir $HOME/provseg/ #temporary datafile created
<br>echo &quot;enter the name of the polylines vector &quot;<br>read rh<br>echo &quot; &quot;<br>echo &quot;the choosen polyline vector is $rh&quot;<br>#the point vector was an esri shapefile with only one column which will be delete in the middle of the script
<br>echo &quot;enter the name of the points vector : &quot;<br>read exut<br>echo &quot;the choosen point vector is $exut&quot;<br>echo &quot; enter a name for the new polyline vector : &quot;<br>read rhfin<br>echo &quot;the name of the new polyline vector will be : $rhfin&quot;
<br>echo &quot; &quot;<br>echo &quot;***************&quot;<br>echo &quot;add columns lcat, along, x and y to the points vector&quot;<br>echo &quot; and calcul of x y coordinates of the points vector&quot;<br>echo &quot;ALTER TABLE $exut ADD COLUMN lcat INTEGER&quot;|db.execute
<br>echo &quot;ALTER TABLE $exut ADD COLUMN along DOUBLE&quot;|db.execute<br>echo &quot;ALTER TABLE $exut ADD COLUMN x DOUBLE&quot;|db.execute<br>echo &quot;ALTER TABLE $exut ADD COLUMN y DOUBLE&quot;|db.execute<br>#calcul of x y coordinates of the points vector
<br>v.to.db map=$exut type=point option=coor units=me column=x,y<br>echo &quot; &quot;<br>echo &quot;***************&quot;<br>echo &quot;distance calculation beetween polyline vector and points vector&quot;<br>#find the cat number of the segment where the point is on
<br>v.distance from=$exut to=$rh from_type=point to_type=line upload=cat column=lcat<br>#find the distance beetween the beginning of the segment and the point<br>v.distance from=$exut to=$rh from_type=point to_type=line upload=to_along column=along
<br>echo &quot; &quot;<br>echo &quot;***************&quot;<br>echo &quot;export of the cat of the segments&quot;<br>#segcat file with points attributs:x,y,cat of the segment<br>v.out.ascii.db input=$exut output=$HOME/provseg/segcat columns=lcat
<br>#segcat2 file with only cat of the segment<br>cut -d&quot;|&quot; -f4 $HOME/provseg/segcat&gt;$HOME/provseg/segcat2<br>echo &quot; &quot;<br>echo &quot;***************&quot;<br>echo &quot;extraction of the selected segments&quot;
<br>#extraction from rh to rh2 of the selected segment with the list of the cat in segcat2<br>v.extract input=rh output=rh2 type=line file=$HOME/provseg/segcat2<br>echo &quot; &quot;<br>echo &quot;***************&quot;<br>
echo &quot;export of the point of the segment&quot;<br>echo &quot;and calcul of the distance beetween these points and the beginning of the segment; results in layer 2&quot;<br>#export of these points from rh2 to rh3<br>v.to.points
 input=rh2 type=line output=rh3<br>echo &quot; &quot;<br>echo &quot;***************&quot;<br>echo &quot;calcul of the x,y coordinate of these points&quot;<br>echo &quot;ALTER TABLE rh3_2 ADD COLUMN x DOUBLE&quot;|db.execute
<br>echo &quot;ALTER TABLE rh3_2 ADD COLUMN y DOUBLE&quot;|db.execute<br>#calcul of the x y coordinate<br>v.to.db map=rh3 type=point layer=2 option=coor units=me column=x,y<br>echo &quot; &quot;<br>echo &quot;***************&quot;
<br>echo &quot;creation of a column TYPE in the vectors points&quot;<br>echo &quot;ALTER TABLE rh3_2 ADD COLUMN type VARCHAR(10)&quot;|db.execute<br>echo &quot;ALTER TABLE $exut ADD COLUMN type VARCHAR(10)&quot;|db.execute
<br>#in rh3, TYPE has the valor: rh<br>echo &quot;UPDATE rh3_2 SET type='rh'&quot;|db.execute<br>#in $exut, TYPE has the valor: exut<br>echo &quot;UPDATE $exut SET type='exut'&quot;|db.execute<br>echo &quot; &quot;<br>echo &quot;***************&quot;
<br>echo &quot;export of the points attributs of rh3 and exut<br>#segcat3 file has points and attributs of rh3<br>db.select -c table=rh3_2&gt;$HOME/provseg/segcat3<br>#segcat4 file has points and attributs of exut<br>db.select
 -c table=pt_exut&gt;$HOME/provseg/segcat4<br>#in segcat5 file we deletes the esri shp column of exut<br>cut -d&quot;|&quot; -f1,3,4,5,6,7 $HOME/provseg/segcat4&gt;$HOME/provseg/segcat5<br>#kill segcat4<br>rm $HOME/provseg/segcat4
<br>echo &quot; &quot;<br>echo &quot;***************&quot;<br>echo &quot;merge all the points of rh and exut&quot;<br>#sort segcat3 file by cat ; creation of segcat30<br>sort -k2n -t'|' $HOME/provseg/segcat3 &gt;$HOME/provseg/segcat30
<br>#sort segcat5 file by cat ; cretion of segcat50<br>sort -k2n -t'|' $HOME/provseg/segcat5 &gt;$HOME/provseg/segcat50<br>#sort an merge segcat30 and segcat50 by cat and after by distance ; creation of segcat6<br>sort -m -k2n -k3g -t'|' $HOME/provseg/segcat30 $HOME/provseg/segcat50&gt;$HOME/provseg/segcat6
<br>#kill segcat30 and segcat50<br>rm $HOME/provseg/segcat30<br>rm $HOME/provseg/segcat50<br>#delete the first column (cat of the points) in segcat6 ; creation of segcat9<br>cut -d&quot;|&quot; -f2,3,4,5,6 $HOME/provseg/segcat6&gt;$HOME/provseg/segcat9
<br>#kill segcat6<br>#the next line ar suggestions of the way I want to choose to finish<br>#???????????????????????????????????????<br>#???????????????????????????????????????<br>#creation of the input ascii file for the creation of the new polyline vector&quot;
<br>#in the old vector file, we must delete the selected segment<br>#merge the new and th old polyline vector together, build topology<br>#kill the temporary files <br><br>Cheers<br>Mick<br><br><br><br><br>