Bug report #21343
[Processing] Distance to nearest hub (line to hub) is not accurate regarding the center used for calculation
|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|
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.
#2 Updated by Harrissou Santanna almost 2 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).
#5 Updated by Harrissou Santanna almost 2 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)