Looking to add the Distance and the Azimuth from SPLat/SPLong and to EPLat/SPLong Points. Is there an easy way to do this in QGIS.
-
Look here for formulas using Python: https://gis.stackexchange.com/questions/44064/how-to-calculate-distances-in-a-point-sequence – GBG Jun 08 '22 at 15:53
-
the format is Excel for the Mac – peter b Jun 11 '22 at 13:31
-
I assume what you want to do is : https://docs.qgis.org/3.22/en/docs/user_manual/expressions/functions_list.html?highlight=azimuth#azimuth ?? – Al rl Jun 11 '22 at 17:15
2 Answers
Save your Excel file in csv format and load it to QGIS using
Data Source Manager > Delimited Text. ForGeometry Definition, you can- either simply choose
No geometry (attribute table only) - or use Point Coordinates based on
SPLongandSPLatfields (in case you want to see the points on the map canvas). As your coordinate values are in degrees (lat/lon), be sure to have selectedEPSG:4326asGeometry CRSfor the imported points. ForX fieldselectSPLong, forY fielduseSPLat.
To be able to save the values calculated in the next steps, export the table to a format that can be edited in QGIS like Geopackage.
- either simply choose
In the attribute table, calculate the length of the line using Field calculator with the following expression that generates a new attribute for the length. You must change the CRS used for calclulation to a projected CRS - here I used EPSG:7405, British national grid. Change this accordingly.
length ( transform( make_line ( make_point ( "SPLong" , "SPLat" ), make_point ( "EPLong" , "EPLat" ) ), 'EPSG:4326', 'EPSG:7405' -- change this to a CRS appropriate for measurements in your area of interest ) )To calculate azimuth, use this expression:
degrees( azimuth( make_point ( "SPLong" , "SPLat" ), make_point ( "EPLong" , "EPLat" ) ) )
- 71,072
- 14
- 78
- 208
The easiest one that works for newbies is the suggestion to do in Excel. Thanks to Chris Veness and his brilliant VBAs I have solved my own issues...
I find this problem is easiest to solve by working in a spreadsheet, not using the GIS.
-
Link-only answers are problematical, since links fail over time. You need enough content to make the Answer standalone. – Vince Jun 12 '22 at 16:24
