I have an application where we need to plot the course of various different vehicles. We need to mark the trail with markers showing which direction they are facing about once every minute. What we end up with is up to 100,000 markers needing to be plotted.
As far as I can tell the only way we can actually plot said marker is by generating a bitmap and passing it to the API, but this ends up using a lot of memory and is unusably slow. I've added caching to the code so that bitmaps aren't generated unless absolutely needed, but it's still too slow. As an example, it takes about 30 seconds to plot ~10,000 markers on a Nexus 5. Drawing the actual polylines, however, is quite fast (but I need markers along the polyline). MapKit (from Apple) plots an equivalent number of markers in under half a second on an iPhone 5, presumably because we don't have to generate bitmaps. So..
MapMarkers?Drawable instead of an Image?Map? At the moment I have to do it one by one which is, again, unusably slow (removeMapObjects simply calls removeMapObject in a loop).It's probably worth mentioning that the slow code is definitely the HERE SDK, and specifically Map.addMapObjects and Map.removeMapObjects, and I obviously pass in MapMarker instances.
If you are doing the following:
foreach(MapObject m: myObjects)
map.addMapObject(m);
Then this should help significantly:
map.executeSynchronized(new Runnable() {
public void run() {
foreach(MapObject m: myObjects)
map.addMapObject(m);
}
});
Every time you add a map object it is redrawing the map. Using execute synchronized should batch the update operation to be significantly faster. Also, it is highly recommended you cache any Image objects and re-use the same image if they are identical. Internally the renderer will share the same texture handle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With