PROBLEM: Compute fetch distance
Philip Hurvitz
phurvitz at u.washington.edu
Wed Mar 18 19:07:46 PST 1998
> I want to calculate theoretical maximum wave height for any given point
(or
> predetermined linear waterfront length) on the shoreline of Willapa Bay,
> Washington. In order to do this, I need to calculate the longest linear
> distance from any given point on the shoreline to another (fetch length).
The longest distance from a single "point" on the shoreline to another
"point" on the shoreline? Or from any combination of points? I'll assume
any combination of points
> I would also need to know the angle of this imaginary line relative to true
> north. To confound things, there is a large island in the middle of
> Willapa Bay (Long Island), that creates a "donut" type shape. I have USGS
> 1:24,000 ArcInfo coverages of Willapa Bay to work with.
Are the "points" on the doughnut included in the longest distance
calculation? I'll assume they are.
> I would try brute force, something like this:
> 1) APPEND all shoreline (I presume that you like this version of the shoreline)
> arcs into one coverage.
> 2) GENERALIZE it, if desired
> 3) UNSPLIT arcs, as much as permitted by the vertex limit
> 4) DENSIFYARC with the ARC option
---snip---
Create a bunch of very short arcs here. Use a densifyarc tolerance that
represents a minimum distance between sample points.
Once you have these nodes, then NODEPOINT to create a point cover. Now
your points are the actual sampling/calculation points for fetch.
Then run point.aml on the point cover you just created. The aml will
find for every point the farthest point away in the coverage. Once found,
it will calculate the distance and azimuth.
If you aren't faint of heart, take a look at the AML. I'm about to go
cross-eyed.
-P.
-------------- next part --------------
/* point.aml
/* for each point in a coverage, find the farthes other point.
/* once found, calculate its distance and azimuth from the input point.
/*
/* Phil Hurvitz, University of Washington
/* 1998.03.18
/*
/*----------------------------------------
/* run in Arcplot
&if %:program% ne ARCPLOT &then
&return Please run in arcplot
/* I need a station file set for the getcover function.
&if [show &station] ne 9999 &then
&station 9999
/* put the coverage name in a variable for later use
&setvar point_cov [entryname [getcover * -point]]
/* close any open files first
&setvar closeall [close -all]
/* clear selected set
clearselect
/* create items in the %point_cov%.pat to hold the id, angle,
/* & distance of the farthest point
&if ^ [iteminfo %point_cov% -point far_point -exists] &then
arc additem %point_cov%.pat %point_cov%.pat far_point 10 10 i
&if ^ [iteminfo %point_cov% -point far_dist -exists] &then
arc additem %point_cov%.pat %point_cov%.pat far_dist 10 10 i
&if ^ [iteminfo %point_cov% -point far_angle -exists] &then
arc additem %point_cov%.pat %point_cov%.pat far_angle 6 6 n 2
/* create a couple temp files to contain point IDs
&setvar pointfile [scratchname -prefix junk -file]
&setvar pointcopy [scratchname -prefix junk -file]
&if [exists %pointfile% -file] &then
&setvar delstat [delete %pointfile% -file]
&if [exists %pointcopy% -file] &then
&setvar delstat [delete %pointcopy% -file]
&setvar numpoints [listunique %point_cov% -point %point_cov%# %pointfile%]
&setvar copy [copy %pointfile% %pointcopy% -file]
/* open the points files and start reading
&setvar file [open %pointfile% openstat -read]
&setvar file2 [open %pointcopy% openstat2 -read]
&setvar rec [read %file% readstat]
&if [variable fardist] &then
&dv fardist
&do &until %readstat% = 102
&type ----Outer loop------
clearselect
reselect %point_cov% point %point_cov%# = %rec%
&setvar xy0 [show select %point_cov% point 1 xy]
&setvar x0 [extract 1 [show select %point_cov% point 1 xy]]
&setvar y0 [extract 2 [show select %point_cov% point 1 xy]]
/* now I have the x,y coords for the selected point
/* open a new file, a copy of the points file and
/* check the distances & angles
&setvar file2 [open %pointcopy% openstat2 -read]
&setvar rec2 [read %file2% readstat2]
&do &until %readstat2% = 102
&type ----Inner loop------
clearselect
reselect %point_cov% point %point_cov%# = %rec2%
&setvar xy1 [show select %point_cov% point 1 xy]
&setvar x1 [extract 1 [show select %point_cov% point 1 xy]]
&setvar y1 [extract 2 [show select %point_cov% point 1 xy]]
/* aselect the first point
aselect %point_cov% point %point_cov%# = %rec%
/* calculate the angle
&setvar polarangle [radang [invangle %x0% %y0% %x1% %y1%]]
&select %polarangle%
&when 0
&setvar azimuth 90
&when 90
&setvar azimuth 0
&when 180
&setvar azimuth 270
&when 270
&setvar azimuth 180
&end
/* evaluate non-cardinal polar angles and calculate azimuths
&if %polarangle% lt 90 &then
&setvar azimuth [calc 90 - %polarangle%]
&if %polarangle% gt 90 &then
&setvar azimuth [calc 470 - %polarangle%]
&if ^ [variable fardist] &then
&setvar fardist [invdistance %x0% %y0% %x1% %y1%]
&setvar newdist [invdistance %x0% %y0% %x1% %y1%]
&if %newdist% ge %fardist% &then
&do
&setvar fardist %newdist%
&setvar farangle %azimuth%
&setvar farpoint %rec2%
&end
&setvar rec2 [read %file2% readstat2]
&end
&setvar closefile2 [close %file2%]
calculate %point_cov% point far_point = %farpoint%
calculate %point_cov% point far_dist = %fardist%
calculate %point_cov% point far_angle = %farangle%
&dv farpoint fardist farangle
&setvar rec [read %file% readstat]
&end
&setvar closefile [close %file%]
&setvar delstat [delete %pointfile% -file]
&setvar delstat [delete %pointcopy% -file]
&return
More information about the Uw-gis-l
mailing list