0

我花了很多时间在谷歌地图中找到一个在两点之间绘制路径的工作示例。

我终于找到了一个,但它没有画出路径。

有人可以帮我理解为什么(或给我另一个代码示例)吗?这是代码:

https://github.com/frogermcs/RoutePathExample

谢谢你。

4

1 回答 1

0

这个链接解释了如何更清楚地做到这一点 http://csie-tw.blogspot.in/2009/06/android-driving-direction-route-path.html 你知道谷歌地球kml吗? https://developers.google.com/kml/documentation/kml_tut 我曾经用它在谷歌地图上绘制从 1 点到另一个点的路线。解析后,您可以将这些点绘制为 mapView.getProjection().toPixels(start, screenPts); //---add the marker--- Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.pin); canvas.drawBitmap(bmp, screenPts.x, screenPts.y, null);
Point screenPts2 = new Point(); mapView.getProjection().toPixels(end, screenPts2);

//---add the marker--- Bitmap bmp2 = BitmapFactory.decodeResource(getResources(), R.drawable.pin);// pin is a resource you have to add canvas.drawBitmap(bmp2, screenPts2.x, screenPts2.y, null);

于 2012-10-18T19:08:55.407 回答