Greetings! The PostGIS azimuth function seems to use a simple arctan function to determine azimuth. If you convert your coordinates to a projected coordinate system and then run the query, your results will be much closer to the FCC site's results. Here is a quick conversion to UTM Zone 31: select degrees(azimuth( 'POINT(634714.442133176 5802006.052402816)', 'POINT(634731.2410598891 5801981.648284801)' )); which yields an azimuth of 145.457858825445. Points in the center of the UTM zone, or a more suitable projection would give better results. Regards, Tom --------------------------------------- Tom Glancy
Minnesota Department of Natural Resources St. Paul, MN 55155-4025 --------------------------------------- >>> Shane Wegner <[EMAIL PROTECTED]> 7/23/2008 10:50 AM >>> Hello all, We have encountered a bit of a puzzle and are trying to figure out why Postgis's azimuth function differs from those on the web including the geocalc php class. I checked with the official FCC site: http://www.fcc.gov/mb/audio/bickel/DDDMMSS-decimal.html http://www.fcc.gov/mb/audio/bickel/distance.html Using the following coordinates: Lat A: 52.3517733 52? 21' 6.3828" Lon A: 4.9779616 4? 58' 40.6626" Lat B: 52.3515499 52? 21' 5.58" Lon B: 4.9781983 4? 58' 41.5122" FCC site results: Distance between N Latitude 52 21 6.38, E Longitude 4 58 40.66 (Point 1) and N Latitude 52 21 5.58, E Longitude 4 58 41.51 (Point 2) is: 0.030 kilometers; 0.018 miles Azimuth from point 1 to point 2 = 147.36? Azimuth from point 2 to point 1 = 327.36? GeoCalc.class results (no rounding): The distance between: Point A (Latitude 52.3517733 and longitude 4.9779616) and Point B (Latitude 52.3515499 and longitude 4.9781983) is: 0.0295893693401 km, 0.018 miles, Great Circle formula, and 0.0296323390621 km, 0.018 miles, Accurate Ellipsoid formula. Point B is at 147.089942074 degrees, or to the southeast by south, from point A. And PostGis: gps=> select degrees(azimuth( 'POINT(4.9779616 52.3517733)', 'POINT(4.9781983 52.3515499)' )), Distance_sphere( 'POINT(4.9779616 52.3517733)', 'POINT(4.9781983 52.3515499)' ); degrees | distance_sphere ------------------+----------------- 133.344225772517 | 29.589241096272 (1 row) So one function reports 147 degrees angle and PostGis is reporting 133 degrees. Just wondering which is correct and why the reported difference? Shane _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users