0

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

Community
  • 1
  • 1
xorgx3
  • 473
  • 1
  • 6
  • 14

1 Answers1

1

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 (e.g. "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 (e.g. "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!!

AniV
  • 3,997
  • 1
  • 12
  • 17
  • But how can i communicate between java and javascript code? My waypoints are in java list(or in xml file), and i don't know how correspond with google maps api in js. – xorgx3 Jan 03 '15 at 14:50
  • You can give it a shot by trying something similar shown in this https://developers.google.com/maps/documentation/javascript/examples/directions-complex. And since you are using a library, I dont know how it can be leveraged with that. – AniV Jan 06 '15 at 02:17
  • Maybe you can use the approach used in [this JxBrowser example](https://sites.google.com/a/teamdev.com/jxbrowser-support/samples#TOC-JavaScript). – Freek de Bruijn Jan 06 '15 at 10:40