ANDROID从大量的经度/纬度点上绘制一个图形页面的路径 [英] Android draw a path on a mapView from a large amount of longitude/latitude points

查看:173
本文介绍了ANDROID从大量的经度/纬度点上绘制一个图形页面的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写这需要借鉴包括大量的GPS点路线(长+ LAT)一个应用程序。该点并拢,不遵守道路,简单地画出每个点之间的线是理想的。

I am writing a application that needs to draw a "route" comprised of lots of GPS points (long+lat). The points are close together and don't follow roads, simply drawing a line between each point is ideal.

当前实现我的很慢,因为我遍历所有的GPS坐标,并创建一个新的点和overlayitem在逐项叠加。这需要大约20秒,它加载所有的这些点,并吸引他们来的MapView。有,我可以从GPS坐标构建一系列线或点,并吸引他们到的MapView?一种方法

The current implementation I have is very slow as I am looping over all the GPS coordinates and creating a new Point and overlayitem in an itemized overlay. This takes around 20 seconds for it to load all of these points and draw them to the mapview. Is there a way in which I can construct a series of lines or point from the GPS coordinates and draw them onto the mapview?

目前的实施例:

 for each set of long+lats // removed to simplify
    point= new GeoPoint(latitude,longitude);
    overlayitem = new OverlayItem(point,"","");
    itemizedOverlay.addOverlay(overlayitem);
 mapOverlays.add(itemizedOverlay);
 mMapController.setCenter(point);

在此先感谢,希望我已经解释的不够好。

Thanks in advance, hope I've explained it well enough.

推荐答案

检查我在这里code样品回应:

Check my reply with code sample here:

<一个href="http://stackoverflow.com/questions/3109158/how-to-draw-a-path-on-a-map-using-kml-file/3109723#3109723">http://stackoverflow.com/questions/3109158/how-to-draw-a-path-on-a-map-using-kml-file/3109723#3109723

此示例解析一个KML文件(作为路由计算提供的谷歌地图或谷歌地球XML格式),并提请地缘点到地图上。如果您已经拥有地缘点的列表,你可以看一下drawPath()方法;调整你通过地理COORDS参数的方式(我封装成,我叫NavigationDataSet一个简单的bean)。

This example parses a kml files (xml format as provided by Google Maps or Google Earth for route calculation) and draws the geo points onto the map. If you already have a list of geo points, you can just look at the drawPath() method; and adjust the way you pass the geo coords parameters to it (I encapsulated it into a simple bean that I named NavigationDataSet).

这篇关于ANDROID从大量的经度/纬度点上绘制一个图形页面的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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