简体   繁体   中英

Show route between multiple points on Google Maps

I have a multiple latitude and longitude coordinations, from .tcx file(endomondo). I keep this points as Strings in ArrayList. I want to display walking route between these points on google maps in my swing application. I use JxBrowser library to display Google Maps.

I tried do something like this, but new Google Maps doesn't works good with them. https://stackoverflow.com/a/13565648/1916252

Of course, it looks like working, but I have to a lot of clicking("Get directions" - choose "walk", etc).

Finally I want to have something like here: https://www.endomondo.com/workouts/297894781/766697

In order to just get the Walking direction on the map, the place where you are calling the Direction Services API that are available in Google Maps V3. This object communicates with the Google Maps API Directions Service which receives direction requests and returns computed results. You may either handle these directions results yourself or use the DirectionsRenderer object to render these results. Directions may specify origins and destinations either as text strings (eg "Chicago, IL" or "Darwin, NSW, Australia") or as LatLng values. The Directions service can return multi-part directions using a series of waypoints. Directions are displayed as a polyline drawing the route on a map, or additionally as a series of textual description within a element (eg "Turn right onto the Williamsburg Bridge ramp").

For setting the direction for just Walking, Use this following line of code

google.maps.TravelMode.WALKING

For more information please follow the guidelines given in this link .

Hope this would help!!

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