I am doing some very simple routing. I get 2 locations that are very close together and I want to get a route between them. The locations will never be more than 1 intersection apart, so no more than 2 roads will be used. We are using the Open Street Maps data from World Mapkit.
I find the 2 spots on the roads, I then see if I need to join the 2 roads they are nearest to together. The result of joining those 2 roads is a MultilineShape. This shape type has a function called GetLineOnALine. Below is my result. The Blue Dots are my end locations. The Red line is the result of my GetLineOnALine function.
As you can see it doesn’t return a result that looks like a LineOnALine, it returns 2 lines that don’t intersect at all. What can I do to get the shortest path between 2 points on a multilineShape? In short, is there a way to get a shortest path between 2 locations on a multilineShape?
MultilineShape GetLineOnALine returns bad result
Hi Jake,
The GetLineOnALine result related with the end vertex passed in.
I know you want to get a route between two blue vertex, but in the horizontal line you get the correct result, in the vertical you should choose incorrect end, so the line looks go forward the other end.
The vertex 0 and 1 in a line is related with the data, so you should have your custom logic to make sure choose which end to get your line by GetLineOnALine.
Regards,
Don
I don’t see an override on GetLineOnALine using MultilineShape that takes in more than 2 points. I pass in the start point and the end point, but I don’t get a line between them, I get the result above. Is there a correct way to use GetLineOnALine with a MultiLineShape? Or is that a function that won’t work with MultilineShapes and only work with LineShapes?
In other words, using a MultilineShape, what are the parameters I need to use to get a valid result? The Disjointed line above is not a valid result.
Hi Jake,
Please see the ticket, and we will update there.
Thanks,
Peter