1

Excel sheet

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.

peter b
  • 19
  • 3
  • 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 Answers2

1
  1. Save your Excel file in csv format and load it to QGIS using Data Source Manager > Delimited Text. For Geometry Definition, you can

    • either simply choose No geometry (attribute table only)
    • or use Point Coordinates based on SPLong and SPLat fields (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 selected EPSG:4326 as Geometry CRS for the imported points. For X field select SPLong, for Y field use SPLat.

    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.

  2. 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
       )
    )
    
  3. To calculate azimuth, use this expression:

    degrees(    
        azimuth(
            make_point ( "SPLong" , "SPLat" ),
            make_point ( "EPLong" , "EPLat" )
        )
    )
    
Babel
  • 71,072
  • 14
  • 78
  • 208
-1

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.

http://www.movable-type.co.uk/scripts/latlong.html

Vince
  • 20,017
  • 15
  • 45
  • 64
peter b
  • 19
  • 3
  • 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