Bug report #21343

[Processing] Distance to nearest hub (line to hub) is not accurate regarding the center used for calculation

Added by Harrissou Santanna about 5 years ago. Updated about 5 years ago.

Status:Open
Priority:Normal
Assignee:-
Category:Processing/QGIS
Affected QGIS version:3.5(master) Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:29161

Description

I calculate the distance to nearest hub from polygons to lines layers and it happens that the generated lines origin or destination is sometimes wrong: i would expect it to use the centroid of the provided features but it does not seem to be the case and it's neither their point on surface.
In the attached screenshot, points represent the centroid and point on surface of the polygons and green line features are the output: you'll notice that they do not snap to these points (not always) and in one case the last point of the hub line is not snapped on the destination line.
Data used are the ones of the training data.

distancetonearesthub.png (53.6 KB) Harrissou Santanna, 2019-02-21 09:47 PM

History

#1 Updated by Nyall Dawson about 5 years ago

  • Status changed from Open to Feedback

It is using the "point on surface" GEOS routine. Do you see the same positions when running the "Point on Surface" algorithm alone?

#2 Updated by Harrissou Santanna about 5 years ago

On the screenshot, the pink point represents the centroid and the purple(?) represents the point on surface, for polygon layers. They are calculated using the dedicated algorithm, alone. You can see that the big polygon has nothing right while the small one seems good (at least for the polygon as it does not snap to the point on the river surface).

#3 Updated by Harrissou Santanna about 5 years ago

  • Status changed from Feedback to Open

#4 Updated by Nyall Dawson about 5 years ago

  • Status changed from Open to Feedback

Can you elaborate which datasets you used?

#5 Updated by Harrissou Santanna about 5 years ago

  • Status changed from Feedback to Open

I used the protected_areas.shp file in https://github.com/qgis/QGIS-Training-Data/tree/v2.0/exercise_data/shapefile and either the rivers.shp along or the roads layer in the gpkg at https://github.com/qgis/QGIS-Training-Data/blob/v2.0/exercise_data/training_data.gpkg (sorry I don't remember - I just pulled in the data I had around to test the algorithm before I wrote anything about, hence nothing serious I could remember the data used)

Also available in: Atom PDF