The Move From Raster Tiles to Vector Tiles -- Making Lots of Maps Dynamically
At Empower Engine, we generate a ton of web maps for Democrats and their allies, dynamically and on the fly. We used to only produce Leaflet maps showing raster tiles (both image tiles and UTF grid tiles). In the last year, we’ve started using vector tiles as well. The data we precompute for each type of maps is different in each case.
Our original application makes maps to show both static data and data that updates daily; the data is rescaled for each user based on the district where they are working. Every such map requires a new set of raster tiles to be generated by Tilestache, and it necessitates tons of caching. We invalidate the tiles whenever the data on a map was updated. Last year, I gave a talk called “Caching Is Your Friend”, describing everything we precompute in order to make these dynamic data maps possible.
We now produce a second type of maps, which people can use data to categorize districts. We have migrated to vector tiles shown on Mapbox GL for these categorization maps. There is still a lot of information we precompute to make these dynamic maps possible, but the caching is not as extensive as with our raster data maps. We can send dynamic data in a web request and reuse our tiles.
I will demo each type of map briefly, and then I will talk about making the move from vector to raster. I will compare and contrast what we precompute for each type of map. Geospatial queries are slow, so we never run them in the web request/response cycle in either case.
In most situations, vector tiles are preferable, and we will likely migrate our old data maps to use vector tiles after the 2016 election. That said, there are some advantages we’ve seen for raster tiles, and I’ll get into that too.
About 10-20% of my talk will be review for those who heard me last year, but most of the talk will be new.