I want to be able to generate a distance line between two points on the map, which also has the distance as a label (similar to the second image seen on Google maps or in the first image from the red point to Aberdeen).I have used the measure line tool and it has provided myself with a distance, however I am yet to figure out how to produce a line with the classified distance labeled on it. does anyone know how to solve this issue. I am using QGIS versions 3.2

I want to record the distance from the red point to the location of Aberdeen so that when I go into {print composer} I can make a map which has a line running between the two distance with its distance e.g 100km recorded I don't have the distance recorded in my {attribute table} would I need to download that data then once collected, I would be able to draw the line?

Location map

enter image description here


This is pretty simple so I'll give you the steps but if you are brand new to GIS then you will need to look up more for each individual step but Google is your friend.

Create a new shapefile layer and set it's geometry to 'Line'.

Select the new line layer in the table of contents and toggle editing.

Enable snapping.

Click Add Line Feature and digitise a line from point A to B.

Open the layer's attribute table.

Open the Field Calculator.

Create a new field called 'Distance', make it a decimal number and give it an appropriate length and precision.

In the expression window type '$length'. This will give the field the length of the line in metres (depending on your coordinate reference system). To make this kilometres change the expression to '$length / 1000'.

Under the layer's properties enable editing using the 'Distance' field.

This will now display in the layout view.

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.