0

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

  • Do your layers have the same crs? – firefly-orange Apr 9 '18 at 9:01
  • Yes, both layers are set to NAD83 and they both show up on the map – Matt Javier Apr 10 '18 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 – dexgecko Sep 28 '18 at 20:37
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, privacy policy and cookie policy

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