简体   繁体   English

Android,在谷歌地图上绘制路线

[英]Android, draw route on google map

In my android project I want to draw route on Google maps. 在我的android项目中,我想在Google地图上绘制路线。 I have coordinates of start and end points. 我有起点和终点的坐标。 On this points I get km -file from Google web service with points witch across route. 在这一点上,我从谷歌网络服务获得km -file,其中包含穿越路线的点数。 For drawing parts of route I use instances of Overlay class. 对于绘制路径的部分,我使用Overlay类的实例。 And this solution works, but very slowly. 这个解决方案有效,但速度很慢。 Are there another methods to do that? 还有其他方法吗? May be exists ability use built-in Google maps application or any another way? 可能存在能力使用内置谷歌地图应用程序或任何其他方式?

Right, you can use the built-in google maps application via an intent like this: 是的,你可以通过这样的意图使用内置的谷歌地图应用程序:

Intent intent = new Intent(android.content.Intent.ACTION_VIEW, 
Uri.parse("http://maps.google.com/maps?saddr=20.344,34.34&daddr=20.5666,45.345"));
startActivity(intent);

see this question for more details 有关详细信息,请参阅此问题

there's a tutorial for using KML here: http://csie-tw.blogspot.com/2009/06/android-driving-direction-route-path.html 这里有一个使用KML的教程: http//csie-tw.blogspot.com/2009/06/android-driving-direction-route-path.html

and some sample code here: How to draw a path on a map using kml file? 以及一些示例代码: 如何使用kml文件在地图上绘制路径?

it all looks like a lot of overly-complicated hard work - Google should provide API's for this instead. 这看起来像是一些过于复杂的艰苦工作 - 谷歌应该为此提供API。

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

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