[GRASSLIST:923] Re: Planning swath bathymetry surveys

Hamish hamish_nospam at yahoo.com
Thu Apr 27 03:01:00 EDT 2006


> http://david.p.finlayson.googlepages.com/swathwidth

Ok, here you go.. working with a spearfish example:

g.region n=4926340 s=4921410 w=590010 e=592930 res=10

r.mapcalc bathy=elevation.10m-1250
r.colors bathy rule=terrain

v.in.ascii -n format=standard out=survey << EOF
L 2
 591046 4924704
 592377 4924468
EOF
#1.35km long

BEAM_MULT=3
DEM=bathy
LINE=survey

v.to.points input=$LINE output=temp_point dmax=100

d.rast $DEM
d.vect $LINE
d.stations temp_point  #wiki add-ons

v.db.addcol map=temp_point layer=2 columns="elev double"
v.what.rast vect=temp_point rast=temp_swath layer=2 col=elev
v.buffer input=temp_point output=temp_circles type=point layer=2 \
  bufcol=elev debug=buffer

# As stated before, "v.buffer bufcol=" is buggy in the cleaning step,
# which is why you get only center area as solid. So we do it manually:

# break polygons at intersections (flatten circles)
v.clean in=temp_circles out=temp_circles2 tool=break

# add centroids making areas
v.category in=temp_circles2 out=temp_circles3 step=0

# disolve common boundaries
v.extract -d type=area in=temp_circles3 out=temp_circles4

# (this works, maybe a clue as how to process bufcol data in v.buffer??)

# cleanup
g.rename v=temp_circles4,swath_area
g.mremove -f vect=temp_circles*

Done! One worm created.
proof: http://bambi.otago.ac.nz/hamish/grass/swath.png

# query area
d.what.vect -x
swath_area in user1  Area
Size - Sq Meters: 595889.059            Hectares: 59.589
           Acres: 147.244               Sq Miles: 0.2301
# or
v.report swath_area op=area units=kilometers
|1|0.595889058998155


v.to.rast...
r.mapcalc MASK=...
r.univar ...
etc.

I really encourage you to try and get the v.mkgrid solution working, as the
results will be much more "real".


Hamish




More information about the grass-user mailing list