-1

i'm making app about trip planner where user favorite a few place in a city and i'm suppose to route that place for user. i need to route each so i can calculate the shortest traveling time possible.

can anyone suggest me how to solve this ?

i know google API have a routing algorithm but that just take place 1 to place 2. currently i'm thinking about implementing Dijkstra's algorithm to this routing problem. any suggestion ? thanks

1 Answers1

0
  1. First you need latitude and longitude your places. If you don't have a latitude longitude your places then use Geocoder. Geocoder return latlng from city names. Add this latlng to list.

  2. Use distance matrix API for find distance/durations between your places. Send latlng list to distance matrix api. You will get the url for connect to API.

  3. Parse JSON objects and get durations/distances. Create matrix with durations/distances.

  4. Send your matrix to your algorithm(Dijikstra or prim)