I would like to use the distance matrix tool (or a similar function) to look at distances between sites (displayed as point data) and large rivers (displayed as linear).
I have been following this nearest neighbour tutorial until now http://www.qgistutorials.com/en/docs/nearest_neighbor_analysis.html
But the distance matrix tool only allows for point data. Apart from the fact my input layer (European rivers) is linear, the initial aim of this research is pretty basic. I want to find the mean distance between my sites and major rivers (later i want to examine the results in terms of travel times using slope data but that's a diffrent question I guess).
Is there a precedent for this kind of research or am I on the wrong track entirely? Am using QGIS 2.16.
Answer
I did have the same the same research question as you. I wanted to calculate the distance from archaeological sites to rivers. I did have access to a hydrological layer by INEGI. I did have rivers as lines and as polygons. This is what I did. First I converted the polygons to lines using vector/ geometry tools/polygon to lines. Now I did have all my rivers as lines. I merged both layers using vector/data management tools / merge shapefiles to one.
Now with just one line layer I extracted the nodes of this layer with vector/ geometry tools/extract nodes. You can see the result. One piece of advice. For some reason all my nodes were extracted as multipoint, so I used vector geometry tools/ multipart to single parts to have my nodes as individual nodes (look at this Problem with Distance Matrix in Qgis 2.83).
Assigning an individual identifier is easy . Using the field calculator, you can use under variables the row_number function. This will add a consecutive ID to each node.
Now you can use the distance matrix tools as described in the link you mention. Here are my results following the same tutorial
As you can see, Is not a one step procedure, but It did work.
Hope it help you
No comments:
Post a Comment