3

I want to calculate the distance of archaeological sites to the nearest river. Following this question Calculating minimum distance between points and polygons in QGIS? I extracted the nodes of the rivers layer and assigned a unique ID to each resulting point. I have a layer of almost 90,000 points/nodes. My archaeological sites layer has only 42 sites. Both layers are in EPSG 32615 (UTM 15N WGS84). I performed the Distance Matrix with the following settings:

Input Layer: Sites

Unique ID input layer: Site ID

Target Layer: nodes

Target unique ID: nodes id

Use only the nearest (k) target points" as 1

Now the problem, the resulting distance matrix states that all the sites have the same neighbor and are at the same distance of it:

enter image description here

This is not the only weird thing. The resulting distance should be in meters, since my layers are in EPSG 32615, but the resulting distance is almost two million meters!!. With Qgis manual measuring tool the distance between the “master node” to the nearest sites is almost 25,000 meters, and to the furthest one about 56,000 meters.

I wonder if someone could give me a hint on what I am doing wrong.

Ps. I also tried MMqgis hub distance tool, but some of the resulting lines do not lie in a line node, enter image description here

and the calculated distance is the same for every line

enter image description here

2
  • Try this one gis.stackexchange.com/questions/21575/…, it might not be as accurate but is bound to be better than that. Sep 8, 2015 at 3:29
  • I appreciate your answer, but I wonder if I have to rasteriz both layers and sum them with the raster calculator?main thing is raster proximity analysys works with one raster layer. Another thing, following qgistutorials.com/en/docs/nearest_neighbor_analysis.html it seems that "Qgis 2.6 saves systematically Point layers into Multipoint layers which are ignored by distance matrix processing". So I ran vector/geometry/multipart to single part and it seems to work. At least I have a distance matrix with different nodes and more than one distance Sep 8, 2015 at 13:19

2 Answers 2

3

I think all the problem lies in the fact that "Qgis 2.6 saves systematically Point layers into Multipoint layers which are ignored by distance matrix processing". I am working with Qgis 2.83 but I think the same thing aplies. This is what I did:

1) Using Vector/Geometry/multipart to single part I converted my river layers and my sites layer from multipoint to single point.

2) I re-ran Vector/Analysis tool/Distance matrix with the same parameters as in the question

Now I have the follwing results:

InputID, TargetID, Distance

3, 72738, 302.3181046

5, 77335, 2168.573439

6, 77944, 301.662413

7, 77928, 888.5274525

Using an external program I aanalize the data and now I now that 75% of my sites are within 0-,1500 to the nearest river and the rest are between 2500-2800 meters from the river. I located the problem following

http://www.qgistutorials.com/en/docs/nearest_neighbor_analysis.html

one of the comments stated the point/multipoint problem. Just to be in the safe side I saved the project and open a new one. I repeated the workflow and it worked again

1

Distance matrix in QGIS works on two point datasets, meaning that each line in your river dataset will be converted to a (representative) point before calculating the distance / finding the nearest neighbour.

If you need to join a point dataset and a line dataset based on "true" shortest distances between points and lines, you should use v.distance (GRASS) or the NNJoin QGIS plugin (QGIS).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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