0

I created a .csv file with coordinates to show a route between two locations where I live. I want to figure out the distance one would travel to arrive from one location(A) to another(B). With 'Points to Path' I created a layer/vector that links the coordinates in the order one would follow on the route to get from A to B. I know of the "Measure Line" tool on the tool bar, but I'm looking for a way to get a more exact number.

Through the Stack Exchange I've come across this query, "Calculate distance between 2 points following a path in QGIS". I attempted the directions give in both answers, but am unsure how to adjust the SQL code to work for my attribute table, nor do I seem to know how create a 'Unique ID Field' for the 'Distance Matrix' tool. If those are even correct ways to go about it...

Path

Attribute table

1
  • 1
    Use $length in the Field calculator. And then calculate a sum
    – Taras
    Aug 7, 2021 at 20:23

1 Answer 1

2

As your csv file has the coordinate in LatLong format, you will need to reproject the line layer (the one you have created by "Points to Path" tool) onto an appropriate CRS (coordinate reference system).

From the attached image, you seem to be working in somewhere around Michigan. According to Michigan Department of Natural Resources' supporting information, Michigan's current state plane coordinate system is NAD83 - Michigan South (EPSG: 26990).

In QGIS, you can find the same information on CRS. Filtering by 'michigan' will make finding it easier.

enter image description here

If you are satisfied with your choice of CRS, then:

(Step 1): Go to Layers Panel and right click on your line layer to activate the context menu. Choose Export, Save Features As..., and select the designated CRS.

(Step 2) Open the attribute table of the reprojected line layer, and use Field Calculator to calculate the distance by $length (it means the length of the line).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.