Large Number of Points on Mobile Map
Lately we've been talking a lot about vector maps and how to better utilize the capabilities of our Mobile SDK when rendering your maps for your devices.
A question that is often asked is how can you add thousands or even millions of points to your map. Visualizing this many data points can pose some specific challenges. For example if you add them to a VectorLayer via in-memory LocalVectorDataSource the results can appear like this:
There are several issues with this technique. You'll notice the visual overloading of the map in addition to technical memory and speed issues. You may even end up with crashing and "Out-of-Memory" situations.
Fortunately we have not just one but several ways to resolve these challenges!
- Show a small number of POIS and display only relevant categories.
- Use point objects instead of marker or balloon pop-ups if possible. Marker is best for map tilting (2.5D view) because the markers are shown as billboards. However point is much faster and memory-efficient because it does not have the additional necessary logic.
- Optimize marker bitmap sizes by making them as small as you can.
- Use in-storage or an online data source instead of the in-memory data source LocalVectorDataSource. This way you load only visible objects to memory. Our Mobile SDK standard package has an interface VectorDataSource which can be implemented by application. You can use your own database (e.g. SQLite) or an on-line API to load and try not to load everything to memory at once.
- Upload your data to your cartodb.com account and request data using vector or raster tiles torque or our special CartoDBSQLDataSource. We have a ready-made online data source using the CartoDB platform! See our earlier blog post on how to consume CartoDB via the SDK.
- Use vector tiles for the most effective big data rendering and offline usage. Vector tiles can be generated by CartoDB. For offline use you'll need to extract the tiles into an MBTiles file and use it with MBTtilesTileDataSource.
- Use the Mobile SDK GIS Extension which provides ready-made in-storage data sources for ESRI Shape KML and many other geodata file formats. For very big datasets you may still need to use other tips from this list e.g. pre-convert data to vector tile mbtiles.
- Use point or marker clusters to reduce visual overload of markers. Our Mobile SDK provides a special interface and implementation. Note: this requires loading all the data to memory because clusters are created dynamically. This works best with medium sized datasets (>50 000 objects).
P.S. These and many other Mobile SDK features will be shown in a webinar on June 29.
Happy mobile data mapping!