在使用 Google Maps API 3.0 的移动应用程序上添加路径点
我正在开发适用于 Android 和 iOS 平台的应用程序。我的客户要求应用程序必须具有“添加路线”功能。 假设我在应用程序上设置了 TO 和 FROM 点,并且我想显示这两点之间的最佳路线。如果只是这两点就好了。有大量资源可帮助您了解如何继续操作。但如果我想添加一些额外的指示,例如“GO THROUGH”,互联网上没有任何答案。 如果您可以向我指出任何适用于移动平台且此功能有效的应用程序(必须使用 Google 地图),那就太好了。也许您有关于该主题的某种文档或其他材料。
谢谢,迈克(波兰)
I am working on the app for Android and iOS platforms. My client requires that the app has to have "add directions" functionality.
Let's say I have a TO and FROM points set on my app, and I want to show the best route between these two points. If it's just these two points it's fine. There's plenty of resources on how to proceed. But if I want to add some extra directions, like GO THROUGH for example, the internet has no answers for me.
If you could point me to any apps (have to use Google Maps) for mobile platforms, where this functionality is working it would be great. Maybe you have some sort of documentation or some other materials on the subject.
Thanks, Mike (poland)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试将 uri 格式化为:
从:50.74,14.00889+到:51.66444,17.85679+到:52.66444,17.85679
您可以根据需要添加任意数量的+到条款
编辑:
如果您使用 Map api,您应该有这样的代码来计算路线:
您应该能够以所描述的格式添加一些航路点。
try to format the uri like:
from:50.74,14.00889+to:51.66444,17.85679+to:52.66444,17.85679
you can add as much +to terms as you want
edit:
if you ar using the Map api, you supposed to have a code like thisone to calculate a route:
you should be able to add some waypoints in the discribed format.
谷歌地图 API v3 有一个方向重绘器。您可以在两点之间渲染一条多线,并且可以拖动多线,即您可以沿路线选取一品脱并将其重新定位为
航路点。请参阅 API 文档。
或者,您可以捕获地图上的点击事件,并将位置推送到中途停留地数组中以传递路由请求。
The google maps api v3 has a directions rederer. You can render a pollyline between two points and have the pollyline be dragable i.e. you can pick a pint along the route and reposition it as a
waypoint. see the api documentation.
alternativly you can capture click events on the map add push the location into an array of stopovers to pass on the the routing request.