I tried to search for an answer but couldn't find any so I decided to ask.

I would like to ask which would be the best way to get the shortest (and the only one) route between two points from a part of multiple LineStrings?

I have road on the map and it consist of multiple LineStrings. I have user clicked in two places on the map and those are on that road or near it. Now I would like to get the distance between these two points via the road. Does anyone have suggestions how to do it? Is it better to do it in Java backend beforehand somehow or can it be done in Javascript frontend? LineStrings are actually Feature-objects and are stored in MongoDb, so pgRouting won't be an option. I had an idea of using the info from Features and their order on the road, but the problem occurs when I don't know is the nearest point of the clicked point before or after the clicked point in the coordinate array.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.