Render vector tiles to PNG on Android & iOS
For Android, we looked into this a few years ago (circa 2014):
https://github.com/CUTR-at-USF/OpenTripPlanner-for-Android/issues/356
We ended up just using raster tiles, but we were looking at the below tools to potentially do vector rendering at that time:
- Mapzen Vector Tile service - https://github.com/tilezen/vector-datasource/wiki/Mapzen-Vector-Tile-Service.
- Vector tiles render library - http://www.opensciencemap.org/, https://github.com/opensciencemap/vtm
From some quick Googling, I found the below library too (and there are likely more):
- mapbox-vector-tile-java- https://github.com/wdtinc/mapbox-vector-tile-java - it says "Android API level 15 compatibility (as of version 3.0.0)."
Note that Mapzen shut down at the beginning of this year, but according to:
https://mapzen.com/blog/migration/
...they recommend the following for vector tiles and basemaps:
For basemaps and vector tiles, you may want to consider:
- Nextzen (A long-term support version of own own Tilezen)
- Mapbox
- OpenMapTiles
- Thunderforest
- MAPCAT
Long-term support for Vector Tiles is available via Nextzen through 2018 supported by Amazon Web Services, thanks to an award from the Earth on AWS Cloud Credits for Research Program. This includes hosted versions of Tangram JS and the map styles. The vector tile data is an archived December 2017 global build available in a requestor pays S3 bucket with associated serverless software.
Terrain Tiles will continue to be available as an Amazon Public Dataset.
Mapzen Vector Tiles and Cartography are based on the Tangram and Tilezen open-source projects. Read below for information on how to run these services locally.
Tangram scene files saved in a Tangram Play account can be saved to a GitHub Gist or downloaded locally, while Mapzen services are still running.
So I've been able to render tiles from a .mvt source, using MapBox's SDK's MapSnapshotter.
These tiles can then be displayed on the Google Maps SDK (using a custom TileProvider). It's working well: a little bit slower than most raster tiles, but still usable.
On the downside, the MapSnapshotter automatically adds the map attribution label on each snapshot it creates, and thus on each tile, which is not the desired behaviour (the attribution already being displayed in a corner of the screen). The good news is that MapBox SDK is open, so that can be modified.