2

I am trying to use the distance matrix to measure the distance between a crime (input ID) to the closest subway entrance (target layer). The problem is that sometimes the matrix comes out with results, sometimes it doesn't and instead, the algorithm fails.

I get this error in the distance matrix log

Traceback (most recent call last): File "C:/PROGRA~1/QGIS3~1.0/apps/qgis/./python/plugins\processing\algs\qgis\PointDistance.py", line 123, in processAlgorithm matType, nPoints, feedback) File "C:/PROGRA~1/QGIS3~1.0/apps/qgis/./python/plugins\processing\algs\qgis\PointDistance.py", line 155, in linearMatrix fields, out_wkb, source.sourceCrs()) Exception: unknown

Execution failed after 1.39 seconds

Loading resulting layers Algorithm 'Distance matrix' finished

3
  • Do your layers have the same crs? Commented Apr 9, 2018 at 9:01
  • Yes, both layers are set to NAD83 and they both show up on the map Commented Apr 10, 2018 at 12:08
  • Got a similar issue Traceback (most recent call last): File "C:/PROGRA~1/QGIS3~1.2/apps/qgis/./python/plugins\processing\algs\qgis\PointDistance.py", line 135, in processAlgorithm matType, nPoints, feedback) File "C:/PROGRA~1/QGIS3~1.2/apps/qgis/./python/plugins\processing\algs\qgis\PointDistance.py", line 177, in linearMatrix index = QgsSpatialIndex(target_source.getFeatures(QgsFeatureRequest().setSubsetOfAttributes([]).setDestinationCrs(source.sourceCrs(), context.transformContext())), feedback) Exception: unknown Execution failed after 5.16 seconds
    – rovyko
    Commented Sep 28, 2018 at 20:37

1 Answer 1

1

The error code is not helpful for this alg.

A way that works for me is to ensure that both layer are in the exact same CRS (preferably projected) and to ensure that the output layer is not used by any process.

Trying to replace a layer that is already in use will cause this error, in that case simply remove it from the projet and it should work.

Your Answer

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

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