Hello,
I’m trying to extract a segment of the coastline between two user-defined points, following this workflow:
- Use v.split to increase the number of vertices along the coastline (improve precision).
- Provide approximate start and end point locations in a file.
- Snap these points to the nearest locations on the split coastline.
- Generate a network from the snapped points and the split coastline using v.net.
- Extract the segment between the points using v.net.path.
Here are the commands I’m using:
# === 0. Input and output directories ===
rootsdir="/home/amaru/Documents/"
cartodir=$rootsdir"CARTOGRAFIA/COSTA_RICA/"
basedirs=$rootsdir"LABFITMAR/ADVISORIES/"
figsdirs=$basedirs"FIGURES/"
grassdir="/home/amaru/grassdata/"
ipoints=$basedirs"/USER_POINTS/cmver_test-2025.csv"
grass "$grassdir/CRTM05/PERMANENT" --text <<EOF
v.in.ascii input=$ipoints \
output=segment_points separator=comma cat=1 x=3 y=4 \
col="cat integer, segment integer, east double precision, \
north double precision,label varchar(6)" --overwrite
v.clean input=cr_lims_lines output=cr_lims_lines_cleaned tool=snap threshold=500 --overwrite
v.split input=cr_lims_lines_cleaned output=cr_lims_lines_splt \
length=1 units=kilometers --overwrite
v.distance from=segment_points to=cr_lims_lines_splt \
upload=dist,to_x,to_y table=dist_new to_type=line \
output=segment_points_snapped --overwrite
v.db.select map=segment_points_snapped col=cat,to_x,to_y > $basedirs"nn_points.txt"
v.in.ascii input=$basedirs"nn_points.txt" separator=pipe \
output=snapped_points cat=1 x=2 y=3 skip=1 \
columns="cat integer,east double precision, north double precision" --overwrite
v.net cr_lims_lines points=snapped_points op=connect threshold=10000 \
arc_layer=1 node_layer=2 output=cr_coast_net1 --overwrite
echo "1 0 1" | v.net.path cr_coast_net1 arc_layer=1 arc_type=line node_layer=2 \
out=test_segment --overwrite
EOF
All works fine until de use of v.net. However v.net.path does not generate the segment and I got a warning:
WARNING: The point with category [1] is not reachable from the point
with category [0]
WARNING: Destination(s) 1 unreachable (including points outside the
threshold)
I’d appreciate any help or insight on what might be going wrong. I’ve shared the relevant files in case anyone can take a look: It is the coastline and the file with the start and end points of the segment.
Thank you all