Why Vector Tiles?
Visualizing large amounts of GIS data on a web map can prove difficult on lower end PCs and mobile devices. A GIS server is often used to alleviate this problem by pushing small static images, or tiles, to the browser instead of the raw data. However, maintaining the server, updating the data and the image tiles, and interacting with it in the browser can all prove challenging. At OVRDC we are meeting these challenges through the use of vector tiles.
No longer bound by the limits of static images, vector tiles are compact enough to send raw data to the browser. This allows for interaction, meaning users can identify features or change a feature’s color or style by clicking on a map. OVRDC uses an mbtiles file to store vector tiles, which is simply an sqlite database. These can then be served through a variety of methods (see below) and visualized using Mapbox GL JS, OpenLayers, Tangram, Leaflet, and many other mapping libraries.
Below we outline our current method for creating, serving and visualizing vector tiles. This is a work in progress, so this post should be viewed as a dynamic document. It is not meant as a tutorial or guide, just a reference for others seeking to incorporate vector tiles into their work. For a detailed look at the technical aspects of vector tiles head over to this great video by Sam Matthews, a Mapbox employee. There is also a WikiPedia entry and a description of the open specification on the Mapbox website.
Desktop GIS > Vector Tiles > Web Maps
- Export GIS data from ArcMap (shapefiles or feature layers) to GeoJSON via esri2open or use the mapshaper command-line tool.
- Optionally export a csv file from the attribute table of the original data with searchable values and a unique ID, and convert to json via csv2json.
- Transfer the GeoJSON to a Linux or Mac (in our case Ubuntu 16.10) and convert the GeoJSON to vector tiles via tippecanoe. – UPDATE 10/17/2017 – We are now using Bash on Windows to enable tippecanoe on Windows 10.
- Copy the mbtiles file to a vector tile server (in our case a Digital Ocean droplet running Ubuntu 16.04 and the mbtiles-server behind NGINX).
Steps 3, 4 and 5 could be automated server-side by simply copying the raw data onto the server, then have the server watch for new files in that directory, do the conversions and copy/overwrite the mbtiles file to the server data folder. The server could also copy/overwrite the geojson to an ‘available downloads’ folder so that users could have access to the raw data if they want and if the client wants.
Note: Vector tiles are a lossy version of the geography.
Vector Tile Server Comparison
mbtiles-server node-js (OVRDC is using a modified version)
Early Index Page Example
Needs links to previews, attributes of the data, and more…
Serves vector and raster tiles from mbtiles file. This is the server that The Gartrell Group highlighted in their 2016 article “A Vector Tile Server for All”. OVRDC is currently running this server on the smallest Digital Ocean instance – 512 MB/1 core Ubuntu 16.04, NGINX, Node-JS, following Tobin Bradley’s example.
Questions still to be answered:
What capabilities can the Node server provide?
How do these align with what counties want in a web map (parcel or anything else) viewer?
Export as shapefile/geojson/etc?
Export attributes as CSV?
Tileserver GL (Tileserver-GL-light) & Tileserver PHP
These applications serve vector and raster tiles from mbtiles. Tileserver GL can optionally render raster tiles from vector tiles via pre configured styles, and generate high-res static images. OVRDC has tried the Tileserver-GL-Light and had some success. It comes with predefined OpenMapTiles styles and offers a more robust server package then the mbtiles-server we are current using. Look for updates on this project in a future post.
OVRDC also has the php version installed on our Apache web server at the link above. The performance of vector tile unpacking from the mbtiles file is not very good. The ortho image examples are on the server as raw folders and files, not mbtiles. The poor vector tile performance may be due to the server cpu, limited memory, or a problem with the php implementation, not sure. It is running on a shared Cent OS Apache server with 512 MB of memory.
GeoServer – OVRDC has tried this on a very limited basis
GeoServer, written in Java, can render and serve cached or on the fly raster and vector tiles from a PostGIS database, shapefiles and other sources. Vector tiles are only possible with a proprietary Boundless plugin or an open source plugin by a Salzburg Research. GeoServer requires a much more powerful server than either the mbtiles-server or the tileserver-gl-light options mentioned above.
Other Vector Tile Server Options
There are a wide variety of GIS server options, these are two that have caught our attention at OVRDC.
Generates vector tiles on the fly from PostGIS, written in GO.
Tilestache – Not updated in over 2 years
Serves raster tiles from mbtiles, generates raster and vector tiles on the fly.