I'm developing an application that's tracing lines of highways on the Google Maps SDK Add-On.
There are a lot of points painted, which inadvertently make the Maps very sluggish to navigate. It seems iOS Maps take care of this issue, as a significant amount of points can be drawn without the maps becoming sluggish.
I started sampling points depending on zoom level. E.g. zoom level 7 only uses, and draws lines to, every 20th point to trace the route. But even that is still too many points and ends up with a very sluggish panning and zooming experience.
Two questions:
One: Is it possible to detect the current region of the map being displayed in the phone, and no longer paint points off-screen?
EDIT - after some initial investigation it's easily possible to detect the clipping region and not paint points/lines. quickReject is the function I've used for this. It does not help too much with performance as all points are still being traversed to identify if they must be drawn - I'm sure it can be optimized.
Two: Is it at all possible to cache, perhaps the path, being drawn (this would have to be done per zoom level, I assume, due to the projection of the point?)