笼络4K折线在谷歌Android地图 [英] draw over 4K polylines in android google maps

查看:172
本文介绍了笼络4K折线在谷歌Android地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发展,现在Android设备的应用程序。其主要功能是绘制折线在地图上显示的是在每个街道城市的喧嚣。不幸的是,当我画3K左右折线 - 数是根据屏幕大小和缩放级别降低 - 我的地图变得慢得令人难以置信......我不提绘制的所有行的时间

I'm developing right now an application for Android devices. The main functionality is to draw polylines on map to show what is the traffic in the city on each street. Unfortunately when I draw around 3K polylines - the number is reduced according to the screen size and zoom level - my map gets incredibly slow... I do not mention the time of drawing all of the lines.

也许你知道,更高效的方式来标记街道或地图上画线?

Maybe you know more efficient way to mark streets or draw lines on a map?

我也想切换到OSM但我从来没有使用过,我不知道它是多么有效。

I was also thinking about switching to OSM but I never used it and I don't know how efficient it is.

我在三星Galaxy Note 10.1调试应用程序,应用程序使用地图API V2

I debug app on Samsung Galaxy Note 10.1 and App uses Map API v2

我的code绘制折线:

My code to draw polylines:

Polyline line;
List<Float> coordinatesStart;
List<Float> coordinatesEnd;
LatLng start;
LatLng end;
List<List<Float>> coordinates;
int polylinesNumber = 0;
for(Features ftr : features){
    coordinates = ftr.geometry.coordinates;

    for(int i = 0; i<coordinates.size()-1; i++){

            coordinatesStart = coordinates.get(i);
            coordinatesEnd = coordinates.get(i+1);
            start = new LatLng(coordinatesStart.get(1), coordinatesStart.get(0));
            end = new LatLng(coordinatesEnd.get(1), coordinatesEnd.get(0));
            line = map.addPolyline(new PolylineOptions()
             .add(start, end)
             .width(3)
             .color(0x7F0000FF)); //semi-transparent blue
            polylinesNumber++;

    }
}

我会AP preciate任何帮助!

I would appreciate any help!

推荐答案

你检查你绘制折线偶可见于屏幕上的用户?如果不是这样,那将是我的第一个想法。 <一href="http://stackoverflow.com/questions/2248510/how-can-i-determine-if-a-geopoint-is-displayed-in-currently-viewable-area">This问题可能是该帮助。

Do you check if the polyline that you draw is even visible to the user on the screen? If not, that would be my first idea. This question could be of help for that.

这篇关于笼络4K折线在谷歌Android地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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