Friday, 12 February 2016

How to findout direction PostGIS


I want to find out the direction from the 2 points from postGIS database. Please see the attached image. I want to find out the direction from the mainPt to any point. But want to get the result as NW, NE, SE or SW. Simply if I get the degree of the angle it can easily be solved.


Thanksenter image description here



Answer



You could use ST_Azimuth for that : http://postgis.net/docs/ST_Azimuth.html


This will give you an angle in radians and the 0 rad angle stands for a point in the north of your main point



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...