GIScience / orstools-qgis-plugin

Plugin for QGIS with a set of tools to use openrouteservice API´s, based on openstreetmap
https://plugins.qgis.org/plugins/ORStools/
MIT License
91 stars 31 forks source link

Result seems incorrect TSP #130

Closed d3netxer closed 3 years ago

d3netxer commented 3 years ago

Here's what I did

Running a batch job, Directions From Points with driving-car travel mode, and a fastest travel preference. I have an 'id' column as the Layer ID field. I have two points with the first ID and the last ID near the Salt Lake City Airport. I want this location to be the starting and ending point for my TSP. I have the checkbox selected to 'Optimize waypoint order (except first and last).

Here's what I got

The processing finished successfully. Here is a screenshot of the output:

TSP_output

Here's what I was expecting

This does not seem like the correct result because I would expect the route would go through a more direct route on the way back to the airport rather than going back the same way.

koebi commented 3 years ago

Hey, it's really hard to debug this without having access to the same data you're using. Could you provide us with the input layer you used for this request, so we can have a look into it? Best regards, Jakob

TheGreatRefrigerator commented 3 years ago

This seems to be a similar problem as https://github.com/GIScience/orstools-qgis-plugin/issues/125 There a workaround is mentioned: You can duplicate your start point as the last point in the list, to make the route go back to your start point

I will close this in favor of #125

graham8 commented 3 years ago

OP says his start and end points are close together. Why would making them coincident improve things?

BTW it's hard to see what the resulting route is - I haven't yet found a way to obtain a list of waypoints in the order they are visited.

koebi commented 3 years ago

OP says his start and end points are close together. Why would making them coincident improve things? As for why that would improve things, have a look at #125 for more information.

The problem here seems to be that the order of waypoints is determined by their QGIS-internal Feature ID. That means that the response is probably correct, the assumption

two points […] with first ID and […] last ID […] be the starting and ending point for my TSP is unfortunately wrong.

The option to specify a custom ordering is tracked in #142.

BTW it's hard to see what the resulting route is - I haven't yet found a way to obtain a list of waypoints in the order they are visited. If points are specified via a points layer, this shouldn't be a problem since it should be obvious from the routing response in which order they are traversed.

If this option is chosen from the Advanced Directions-Tab, I agree - after a route has been generated, there is no way of even seeing the points that have been chosen to create the route. This problem is addressed in #144 and #145