# Measuring distance between points using QGIS?

I have a layer with about 500 single points. Now I want to measure the distance between each of these points and one specified observation point.

I need the distance to show how far away from the observation point every of these points was located to build a table for detection probability.

I already tried lots of plugins (Hub Distance, NNJoin...), but simply can't find a proper way to calculate what I need.

• it looks like your "point" layer isn't made up of points, where did it come from – Ian Turton Jun 27 '17 at 12:08
• Got the points from lines through the Q-Chainage Tool – Lena Jun 27 '17 at 12:14
• Think we'd need your data, or some of it, or more information about it, to diagnose this. The function works for me. Maybe one of your features has a null geometry... – Spacedman Jun 27 '17 at 12:52

Another option from mentioned by @Spacedman is the following:

• Connect target points with the source point (observation one)
• Measure distances for created lines

1. Prepare your data by creating unique fields in both (target and source) layers.
2. Install plugin 'Connect Points'. It is an experimented one, so make sure you ticked 'Show also experimental plugins' on your Plugins menu. Plugin works with WGS 84 CRS only
3. Go to Plugins > Connect Points > Settings and set appropriate options.
4. Run the Plugin. Here is the following result:
5. Resave it with appropriate metrical CRS and count length of these lines by updating the length column with the function \$length.
6. Results are the same as by using 'Distance matrix' plus you've got a vector layer.

Put your observation point in a point layer and use "Distance Matrix" from the Vector... Analysis Tools menu.

Make sure there's a unique ID column in your layer of points. I've got one point in the "source" layer and eleven in the "targets" layer. The table output has the ID of each target point and the distance to the source point. You could join this to the target layer if you need it there. Change the output matrix type to NxT. Here's the dialog and the resulting output:

• I posted a picture in the main-post: The function doesn't work, but I have no idea what caused the error ... – Lena Jun 27 '17 at 11:55
• Hi, I have just run this tool in QGIS 3.2, and it works but the fields with the Id sources (origin and destin points) always keeps in "0", so It's not useful at all :( – Digd Aug 16 '18 at 12:25

OK, thanks so far. I think i figured out my problem. I have doubled IDs in my table so its impossible to connect each point with the source point.