4

I have a tab delimited file with data about earthquakes epicenters and their intensities (signif.txt). I also have a shape file with point data representing populated places of the world (ne_10m_populated_places_simple.shp). I am trying to perform a ‘Distance matrix’ operation to find the nearest populated place for each point in the earthquake layer. However, performing ‘Vector> Analysis Tools> Distance Matrix…’ results following error message:

Traceback (most recent call last):
File "C:/OSGEO4~1/apps/qgis/./python/plugins\processing\algs\qgis\PointDistance.py", line 141, in processAlgorithm
matType, nPoints, feedback)
File "C:/OSGEO4~1/apps/qgis/./python/plugins\processing\algs\qgis\PointDistance.py", line 197, in linearMatrix
featList = index.nearestNeighbor(inGeom.asPoint(), nPoints)
ValueError: Null geometry cannot be converted to a point.

Execution failed after 17.02 seconds

I am following the steps mentioned here and then I have even tried to convert the delimited text layer ‘signif’ to shape file point data and then performing the same operation. However, the result is still the same.

Why is this happening and how do I remove this error?

I am using QGIS 3.6.0 Noosa 64bit (OSGeo4W Network Installer), on Windows 10 machine. Snapshots of the errors are also attached.

enter image description here enter image description here enter image description here

6

The file signif.txt has missing lon/lats for some records which result in null geometries when you add as a delimited text layer or convert to other format.

Either delete them or filter (Right click layer -> Filter... "LATITUDE" IS NOT NULL AND "LONGITUDE" IS NOT NULL) before running the Distance Matrix processing tool.

enter image description here

enter image description here

Note that the QGIS 3 version of the tutorial you are following specifically states:

Before we do the analysis, we need to clean up our inputs. The signif layer contains many records without a valid geometry. These records were imported with a NULL geometry. So let’s remove these records first.

  • 1
    Thank you @user2856, this works. – datakeen Jun 8 at 10:30

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.