Minimal Vector Tile Server for Web Mapping applications
Java Scala HTML Shell
Permalink
Failed to load latest commit information.
docker
media
src
.gitignore
LICENSE
README.md
pom.xml

README.md

Heuristic Experiment in Dynamic Vector Tile Generation for Web Maps

For the keen eyes, I'm using the new Vivaldi web browser

This experimental project is a visualizer of my Vector Tile Encoder as it dynamically generates vector tiles for web applications based on the Javascript API for ArcGIS. Specifically, this visualizer mimics the response of a VectorTileServer REST request emitted by a VectorTileLayer to dynamically search a data source and transform the result set into vector tile features.

The server application is based on Spring Boot and I highly recommend the Spring Initializer for a quickstart.

Fundamentally, the application consists of responding to 3 mapping requests:

  • /arcgis/rest/services/{datasource}/VectorTileServer - This returns the vector tile metadata in JSON for the specified {datasource} such as the full extent of the datasource, min/max scales for visibility and the resolution and scale at different level of details.
  • /arcgis/rest/services/{datasource}/VectorTileServer/styles - This returns the Mapbox GL style in JSON that defines what data to draw, the order to draw it in, and how to style the data when drawing it. Note - Not all the styles are implemented in this project.
  • /arcgis/rest/services/{datasource}/VectorTileServer/tile/{z}/{x}/{y}.pbf - This returns an array of bytes consisting of the Protocol Buffer encoding of a tile based on the Vector Tile Specification for a specified datasource at a specifed level z and specified horizonal x and vertical y placements.

In Action

The easiest and most reliable way to reduplicate the visualization process in action is to use Docker.

docker-machine create --driver virtualbox --virtualbox-memory "1024" --virtualbox-cpu-count "1" dev
  • Get the machine's IP
docker-machine ip dev
  • Setup the docker environment variables
eval $(docker-machine env dev)
  • Run the Vector Tile Server
docker run -it --rm -p 8080:8080 mraad/vector-tiles-boot
  • Open a browser and navigate to http://IP-FROM-ABOVE:8080
  • Shutdown the server by navigating to http://IP-FROM-ABOVE:8080/shutdown.html

The Data Source

As of Apr 8, this implementation relies on a static data source. Later project updates will have a dynamic data source. The static data source is a GZip text file containing the world administrative polygons in geographical coordinates. Each line in the text file is a polygon feature with a set of tab separated attributes and the geometry is in WKT format.

Building the Project

mvn clean package

Building The Docker Image

cd docker
cp ../target/vector-tiles-boot-0.0.2-SNAPSHOT.jar .
docker build\
 --force-rm=true\
 --ulimit nofile=65535:65535\
 --ulimit nproc=25059:25059\
 -t mraad/vector-tiles-boot .

Using Maven

Found this Maven plugin that allows me to control builds and deployments:

mvn package docker:build

Starting and stopping the container:

mvn docker:start
mvn docker:stop

See Also

License

Apache License, version 2.0