I am using the Android's WebView component to display Google Maps with POIs. For displaying the POI I am using the JavaScript API class google.maps.Marker.
The problem is that when all 350 POIs are shown on the map they makes the WebView slow and almost unusable...
How to optimize it???
Is there any API that e.g. puts together the map zoom level with the number of marks displayed? For example if the the zoom level is 0, e.g. 10 POIs is shown and when the zoom level is 10, all which can fit the view port are displayed...
Thanks for help
Regards,
Petr
Too many markers on the map is a well known problem. There are several solutions to this. Nice overview of possible solutions can be found here.
If I sum it up shortly, then the solutions are:
- Clustering: It groups markers such that there are not too many markers visible on the map at one time. If you zoom in, the clusters splits into smaller clusters and/or single markers. You can either create your own marker clusterer or use some library that provides the required functionality. Great solution can be found in Google Maps utility library.
- Marker manager: Marker manager allows you to specify what markers are visible at different zoom levels. Again you can create you own implementation or use a library. Google Maps utility library provides good MarkerManager.
- Viewport managment: The idea is to show only the markers that are necessary to be shown (those that are located in the current viewport). While it doesn't solve the problems completely, it's a good improvement of the previous techniques.
- Fusion Tables: When you use Fusion tables, the markers are rendered on Google servers in a special layer.