2

I am trying to measure the distance from several points to the edge of lake polygons. When I use the Distance to Nearest hub function in Vector analysis, I get the following error message:

QGIS version: 3.30.0-'s-Hertogenbosch
QGIS code revision: f186b8efe0
Qt version: 5.15.2
Python version: 3.9.5
GDAL version: 3.3.2
GEOS version: 3.9.1-CAPI-1.14.2
PROJ version: Rel. 8.1.1, September 1st, 2021
PDAL version: 2.3.0 (git-version: Release)
Algorithm started at: 2023-03-23T23:45:14
Algorithm 'Distance to nearest hub (line to hub)' starting…
Input parameters:
{ 'FIELD' : 'Hylak_id', 'HUBS' : '/Users/user/Downloads/HydroLAKES_polys_v10_shp/HydroLAKES_polys_v10_shp/HydroLAKES_polys_v10.shp', 'INPUT' : 'delimitedtext://file:///Users/user/Documents/Grebe_Population_Points.csv?type=csv&maxFields=10000&detectTypes=yes&xField=Longitude&yField=Latitude&crs=EPSG:4326&spatialIndex=yes&subsetIndex=no&watchFile=no', 'OUTPUT' : 'TEMPORARY_OUTPUT', 'UNIT' : 0 }

Traceback (most recent call last):
File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing/algs/qgis/HubDistanceLines.py", line 120, in processAlgorithm
index = QgsSpatialIndex(hub_source.getFeatures(QgsFeatureRequest().setSubsetOfAttributes([]).setDestinationCrs(point_source.sourceCrs(), context.transformContext())))
Exception: unknown

Execution failed after 0.13 seconds

Loading resulting layers
Algorithm 'Distance to nearest hub (line to hub)' finished

What am I doing wrong? Is there a different function I should be using?

3
  • 1
    Are your layers projected ? See gis.stackexchange.com/questions/304010/…
    – Kasper
    Commented Mar 24, 2023 at 6:19
  • It's going to be hard to diagnose an Unknown Exception without more information. However, keep in mind that Distance to Nearest Hub calculates the distance to the centre of a polygon, not the edge of the polygon, so it doesn't sound like it's going to be the solution to your problem. Commented Mar 24, 2023 at 6:41
  • 1
    This answer may help you: gis.stackexchange.com/a/447505/128665. It uses a Field Calculator expression, rather than the Distance to Nearest Hub tool.
    – Matt
    Commented Mar 24, 2023 at 8:41

0

Your Answer

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

Browse other questions tagged or ask your own question.