[GRASSLIST:5918] Re: Shore Normal transect

Eric G. Miller egm2 at jps.net
Sun Mar 30 13:42:29 EST 2003


On Sun, Mar 30, 2003 at 07:57:42AM -0800, John Chesnut wrote:
> I need to create shore normal transects from established  sampling 
> points at Salton Sea, Ca.
> 
> How do I automate this in GRASS ?
> The tangent point of a radius around the sample would work for this 
> relatively simple coastline.
> 
> In ArcView a "join" calculation records a tangent distance between 
> features. Is there a similar calculation available in GRASS. or do I 
> need to make a looping calculation that increments a radius until a 
> tangent solution is reached ?

v.distance almost does what you need, but not quite, since it doesn't
return the point on the shoreline.  With some effort, it could be
modified, though the search routines used by v.distance would have to be
recreated ;-(.

Presuming the sample locations aren't actually on the shoreline, then
there is a function in the diglib that will calculate the distance of
a point to a line, returning the distance and the point of intersection.
The distance line segment will be normal to the coastline unless the
point is outside the "segment space" (in which case, it is the shortest
distance to an end point).  If the point is actually on the shoreline,
then the distance will be "zero" and the end point will "equal" the
start point (quotes for floating point tolerances of precision).  The
function only works in planar coordinate systems.  In a brute force
iteration, the shortest distance/point will be the desired end point
and distance.  The "status" flag (below) will tell you if it is 
perpendicular to the shoreline segment or the distance to a vertex.


src/libes/vect32/diglib/line_dist.c

/*
** dig_xy_distance3_point_to_line ()
** same as dig_distance2_point_to_line () except returns value in status
**   telling if point is w/in segment space, or past ends
**   
**  status = 0 if ok, -1 if t < 0  and 1 if t > 1
** 
*/

double dig_xy_distance3_point_to_line (
    double *px,double *py,         /* point */
    double x1,double y1,double x2,double y2,    /* line segment */
    int *status)


> A more complex coastline would require "smoothing".  The  normal 
> vector including  the sample point would  describe the shore normal 
> transect.  This approach would require selection and creation of 
> seg,ments of the "smoothed" coastline.   How would I automate the 
> selection process and store the locally smoothed segments.

Maybe v.prune?  I don't know if it really will create the desired
smoothing though...

-- 
echo ">gra.fcw at 2ztr< eryyvZ .T pveR" | rot13 | reverse




More information about the grass-user mailing list