2

I have a vector dataset containing GPS locations/points of different vehicles and a road network dataset. Due to the inaccuracy of the GPS receiver, these gps points can deviate up to 10-20 meters from the road network (see below). To give an indication of the accuracy of the GPS signal I would like to know what the average spatial variation of these GPS points to the nearest road segment is.

Does anyone have an idea on how to calculate this in QGIS?

enter image description here

3

You can "misuse" the tool join attributes by nearest for this purpose. This tool is available since version 3.8 and can be found in processing toolbox. If you are using an older version, you can use the plugin NNJoin, which does the same.

First make sure your both layers are in the correct CRS with meters as unit (or whatever you wish to measure in). Then simply choose your points as input layer and your roads as input layer 2 as seen below.

enter image description here

The output layer will contain a field called distance, which is filled with the distance in CRS units to the next road. In field calculator you can now calculate the mean (or other indicators like min, max, and so on) by creating a new field and using the expression mean("distance").

(it is the minimum distance to a line segment, not to the next line-vertex or something, so the actual real minimum distance).

enter image description here

To visualize the result or as a proof it is working, you could buffer your joined layer by distance field:

enter image description here

1
  • Thanks a lot, that did the trick for me! – winecity Feb 6 '20 at 11:46
1

How I would approach this problem:

1) Add X_ORIG and Y_ORIG columns to your point layer, populate them with $x and $y (respectively)

2) Snap your point layer to the line layer using Snap Geometries to layer using "prefer closest point, don't insert new vertices"

3) On the snapped layer, add X_NEW and Y_NEW columns, populate them with $x and $y

4) Add X_DIFF and Y_DIFF columns, populate them with (X_NEW - X_ORIG) and (Y_NEW - Y_ORIG)

5) Use the Basic Statistics for fields algorithm against the Snapped layer, calculate statistics on X_DIFF and Y_DIFF both.

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.