简体   繁体   English

在Google地图上的多个点之间显示路线

[英]Show route between multiple points on Google Maps

I have a multiple latitude and longitude coordinations, from .tcx file(endomondo). 我有多个经纬度坐标,来自.tcx文件(endomondo)。 I keep this points as Strings in ArrayList. 我将此点保留为ArrayList中的字符串。 I want to display walking route between these points on google maps in my swing application. 我想在我的秋千应用程序中的Google地图上显示这些点之间的步行路线。 I use JxBrowser library to display Google Maps. 我使用JxBrowser库显示Google Maps。

I tried do something like this, but new Google Maps doesn't works good with them. 我尝试做类似的事情,但是新的Google Maps不适用于他们。 https://stackoverflow.com/a/13565648/1916252 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 最后,我想拥有类似这里的内容: 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. 为了仅在地图上获得“步行”方向,您将在其中调用Google Maps V3中提供的Directions Services API。 This object communicates with the Google Maps API Directions Service which receives direction requests and returns computed results. 此对象与Google Maps API路线服务通信,该服务接收路线请求并返回计算结果。 You may either handle these directions results yourself or use the DirectionsRenderer object to render these results. 您可以自己处理这些方向结果,也可以使用DirectionsRenderer对象呈现这些结果。 Directions may specify origins and destinations either as text strings (eg "Chicago, IL" or "Darwin, NSW, Australia") or as LatLng values. 方向可以将起点和终点指定为文本字符串(例如“ Chicago,IL”或“ Darwin,NSW,Australia”)或LatLng值。 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"). 方向显示为在地图上绘制路线的折线,或者显示为元素内的一系列文字说明(例如“向右转到Williamsburg Bridge坡道”)。

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!! 希望这会有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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