[GRASS-user] How to find out an angle between to points on the map (for r.plane, r.lake)

Dylan Beaudette dylan.beaudette at gmail.com
Thu Feb 28 17:49:50 EST 2008


On Thursday 28 February 2008, Philipp Steigenberger wrote:
> Hi
> I want to work with r.plane and r.lake to get simulate floodings in DTMs.
>
> In the section of interest there is a river which runs from about SSW to
> NNE. For r.plane I need the
> azimuth. Is there a tool in GRASS which tells me the angle between two
> points I mark on the map like I can measure in between two points with
> d.measure?
>
>

Simple trigonometry is a start. Or on a computer the atan2() function is 
useful:

atan2( (end_y - start_y) , (end_x - start_x) ) * 180/pi

will return the angle in degrees. The above example is from R, but the C 
implementation should be similar. Check your local documentation.

It shouldn't be hard to add something like this to d.measure for interactive 
estimation of bearings.

On a related note, I wrote a module for GRASS sometime ago called d.bearing 
which would create a transect from a starting point, a bearing, and a 
distance along the resulting line. I will dig the source out and see if it 
still compiles. It might be useful to combine that functionality with what 
you are talking about.


Dylan

-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341


More information about the grass-user mailing list