1
votes

I want to plot optimized route in google map using map api v3. I will have list of waypoints and start location but i don know the end point. So how can i find distant point (from my list of waypoints) from the given start location.

Example

I'm using below link for web services

http://maps.googleapis.com/maps/api/directions/json?origin=chennai&destination=madurai&waypoints=optimize:true|trichy|tanjore|bangalore|kanyakumari|madurai&sensor=false&mode=driving

In above url know my origin ie chennai. but i dont know destination. My destination will be one from list of waypoints.

One way of finding destination is using distance from origin pt. but it is not efficient also i have to send this request for n times based on number of waypoints.

So how can i find destination point which will be distant from origin (chennai) in efficient and simpler way?

1

1 Answers

1
votes

Presumably your destination is normally the most distant waypoint, if your waypoints are stored as lat/long coordinates or you convert them to such then you should get a reasonably first approximation by calculating the great circle distance, example, your final distance may depend on road distance rather then crow-flies but it is a fair chance that the longest road distance will be one of the furthest away. Other than that search the web for "travelling salesman problem" to get some options.