使用Google地图或其他应用程序可以绘制坐标路径并在它们之间导航吗? [英] Is it possible to draw a path of coordinates and navigate between them, using Google Maps or other apps?

查看:90
本文介绍了使用Google地图或其他应用程序可以绘制坐标路径并在它们之间导航吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我知道可以请求导航到指定的位置,如



参数详情 here

This is a simple question.

I know it's possible to request to navigate to a specific place, as shown here.

I know there are also some other APIs for Google Maps (here and here), but I don't see an option to send multiple coordinates, to see the path between them, and navigate between them.

For the Web version, there is the ability for waypoints (example here and here), but not for Android.

Is it possible to do it, via Google Maps, or another app?

Or maybe even in the Google Maps API (within the current app) ?

解决方案

Since V3 Google Maps Directions API support up to 23 waypoints (excluding the origin and destination) when calculating routes:

https://maps.googleapis.com/maps/api/directions/json?origin=sydney,au&destination=perth,au&waypoints=via:-37.81223%2C144.96254%7Cvia:-34.92788%2C138.60008&key=YOUR_API_KEY

So, you can draw polyline with up to 23 points and send they coords in request.

UPDATE: Please see this tutorial.

UPDATE 2:

Example opening navigation mode of Google Maps app for route Tel-Aviv to Jerusalem via Kiryat Malakhi, Beit+Guvrin and geopoint (31.696342, 35.011337) via Intent:

Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
                        Uri.parse("https://www.google.com/maps/dir/?api=1&" +
                                "origin=3780+St+1,+Tel-Aviv+Yafo,+Israel&destination=Jerusalem,+Israel&travelmode=driving" +
                                "&waypoints=Kiryat+Malakhi,+Israel%7CBeit+Guvrin,+Israel%7C31.696342, 35.011337"));
startActivity(intent);

Result:

Parameter details here.

这篇关于使用Google地图或其他应用程序可以绘制坐标路径并在它们之间导航吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆