Sunday, 5 March 2017

grass - Get nearest line to point with v.distance in QGIS


I want to retrieve the nearest line to a point with the GRASS function v.distance(). But I think I do not fully understand how to use this function. What I have are two layers (in the same CRS -> EPSG:31255): one point-layer which contains the locations of all my sensors and one line-layer which contains a streetnet. The following picture shows both my layers: enter image description here


With v.distance, I want to retrieve the nearest line (street) for each point (sensor). Furthermore, I want to update my point-attribut "edgeid" with the id of the nearest line. enter image description here


EVIS_Stat_Sensorik_.. is my point-layer and Reprojiziert is my line-layer. For the upload string I used the "to_attr"-String because the relation between the pointlayer and the linelayer should not be based on the distance, but on the id of the nearest edge. So that the edgeid-attribut will get updated by the function and not some other attributs of the pointlayer. For the "Column name where values specified by upload option.." I chose edgeid because the edgeid should get updated. For the "Column name of neariest feature.." I chose id, because the attribut edgeid of the pointlayer should be updated WITH the id of the nearest line of the line layer.


But the problem is, if I run the algorithm, the output is a NEW pointlayer which is identical with the given input pointlayer EVIS_Stat_Sensorik_.. and the edgeid-attribut of BOTH the input and output pointlayer is still empty. So I do not understand where I can see the results of the algorithm. In the following picture you can se the attributtable of my output-linelayer named "Nearest": enter image description here


I have looked through a lot threads and the duplicate questions do not help me either (How to estimate distance from points to line feature with v.distance? , Nearest distance between point layer and line layer, QGIS, Finding nearest line to point in QGIS? ). Any suggestions?





No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...