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
It's not entirely clear to me what you're doing because I'm not sure how itemizedOverlay is drawing between the points. But I bet the primary problem is that you're using a bunch of OverlayItems when it'd be much faster to just skip that part entirely and override the itemizedOverlay's draw()
method. I've done this before and it works quite well for line drawing. The basic pseudocode is:
create List of GeoPoints
add List to ItemizedOverlay
add a dummy marker to ItemizedOverlay (so that it knows to call `draw()`)
in ItemizedOverlay.draw(), use mapView.getProjection() to map the array of GeoPoints to x,y coords
use Canvas.drawLines() to draw a line between all your points
Since speed is a concern, make sure to create the Paint objects in the ItemizedOverlay's constructor; they can be reused as much as you want.
Also as a side note, it looks like you're using addOverlay()
as demonstrated in the Hello, MapView demo. The only problem with using that is that they call populate()
each time you add an item; if you are adding a bunch of points, it's better to add a bunch of overlays at once then call populate()
at the end.