I am running QNEAT3 on QGIS 3.22.4-Białowieża to determine the shortest path from one location to another along a stream network, but the results are inconsistent. This is being run as part of a graphical model (Figure 1).

For example, in the one area pictured below (Figures 2 & 3), the network distance is calculated for all the origin_id and associated destination_id points, except for point 8. Does the absence of a line tell me something went wrong? The OD matrix, however, does show the correct location and value for the closest point along the stream.

Part of the problem is with the OD matrix (Figure 4). The destination_id distances are not correct. Destination_id 0 to 13 are not all 4691.313 m, actually, destination_id 0 is not able to be reached from origin_id point 8 via the stream network. Although destination_id point 108 is listed and the total cost distance is correct, it is not the smallest total_cost distance, but in the middle of the total_cost range.

Currently, I use the following select by expression statements to filter and select the correct origin-destination locations, or at least I thought I was:

  1. "total_cost" IS NULL or "total_cost" IS 0 <-- filter out all zero and null values
  2. "total_cost" = minimum( "total_cost", "origin_id" ) <-- select minimum total cost
  3. array_first(array_agg($id,"origin_id",order_by:=$id)) = $id <-- extract first row of minimum total cost values from 2.

Unfortunately, this won't work if the OD matrix also includes the smaller total_cost values for the destination_id locations, which it seems to mysterious select and add to the OD matrix.

Parameters used for QNEAT3

Figure 1. Parameters used for QNEAT3. closer view of point 8

Figure 2. Example origin_id 8 point location with no line.

overview to closest location along stream network

Figure 3. Zoomed out view of origin_id point location 8 (hidden behind 60) and closest destination_id point location along stream network (destination_id 108).

enter image description here

Figure 4. OD matrix for origin_id 8.

enter image description here

Figure 5. Distance From origin_id 12 to destination_id 83 is wrong (should be 62 m not 794 m).

This distance is wildly wrong, but the other values for the locations seem to be correct for the most part. My projection is the same for all layers and the project (EPSG26911).

  • I have also posted on the QNEAT3 GitHub page where some files can be found.
    – MJM
    Mar 28 at 21:23
  • Hi, there is currently a bug in the published QNEAT3 version which you can download via the QGIS plugin manager. Please download the current version of the github repository and replace the QNEAT3 plugin folder located in C:\Users\USER\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins with the github version and try again. Does this fix the error?
    – root676
    Mar 29 at 8:50
  • When I try and install via the ZIP I get the following error: ModuleNotFoundError: No module named 'QNEAT3-1' Traceback (most recent call last): File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 401, in loadPlugin __import__(packageName) File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 888, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ModuleNotFoundError: No module named 'QNEAT3-1'
    – MJM
    Mar 29 at 15:06
  • It looks like you have renamed the plugin folder. You have to replace the original QNEAT3 folder with the one from the github zip file and also name it QNEAT3. Then it should work. You can only have one QNEAT3 folder in the plugins directory.
    – root676
    Mar 29 at 21:09
  • It is better for some locations, however, the results are generally the same. For example, the distance for a nearby destination location is recorded as a total_cost of 794 m when it should be 61 m. The other problem is that two origin locations fail to show lines to destinations, but both have the same destination_id '1' with different total_cost values, which happen to to be wrong. The destination_id they both show is very distant and likely unreachable along the network.
    – MJM
    Mar 29 at 22:08


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.