简体   繁体   中英

Including waypoints in query to Google-Maps API on Android

According to this solution Why retrieving Google Directions for Android using KML data is not working anymore?

I've got the question what is the shortest way to draw the route through the waypoints.

  1. Implement itemizedRouteOverlay to store routes route from start point->waypoint1, waypoint1->waypoint2, waypoint2->destination

  2. Merge route objects and draw it as routeOverlay Route1=start->waypoint1, route2=waypoint1->waypoint2 etc..

  3. Add implementation of waypoints in parser

  4. Any other, better way?

Any hints will be appreciated.

The fastest way I found is to: add parameter waypoint with via: prefix for each waypoint to JSON URL string, so it doesn't create more than one leg in JSON (crucial part because there is only one leg support in GoogleParser provided with that example). Google offers only 8 waypoints support for non buisnes customers, so that was another problem. I've managed to bypass it by spliting route to sub-routes, where ending point of one route, was begining point of another route. Each route was stored in list as different routeOverlay object, and then one-by-one added to mapView in the loop .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM