Generating Vector Tiles using the Docker Containers for Windows 10 (Home)

In this lesson we will learn to use Docker containers to deploy various tools to create and serve vector tiles on your laptop running Windows Home Edition.

If you are running Windows 10 Pro or Window 10 Enterprise please use the Windows 10 Pro instructions

1. Install Docker Toolbox

2. Run the Quick Start Terminal

  • Double-click the Quick Start Terminal installed by Docker Toolbox
    • You will execute all the docker commands in the steps below at the Docker Quickstart Terminal prompt
    • For help getting started, check out the docs at https://docs.docker.com

      Docker is up and running!
      To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: C:\Program Files\Docker Toolbox\docker-machine.exe env default
      
                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/
      
  • Docker Toolbox is configured to present it’s default machine as IP 192.168.99.100 to the browser running natively on your computer

3. Install a GDAL/OGR tools container

  • Go to Docker Hub
  • Search for gdal
  • Select klokantech/gdal
  • Copy the Docker Pull Command & run it at Quick Start Terminal prompt

    docker pull klokantech/gdal

4. Convert Shape file into GeoJSON file

  • Download zipped files of King County 2000 Census Block Groups
  • Place zip file into your local user directory (eg: C:\Users\mccombsp)
    • “mccombsp” will be replaced with your local user name
  • Unzip zip file. Be sure that the files are in your local user directory, not in a subdirectory.
  • Use OGR tools at the Quick Start Terminal prompt
    • ogrinfo: check the shape file’s information

      docker run -it --rm -v $HOME:/data klokantech/gdal ogrinfo KingCo_2000_Census_BlockGroups.shp -al -so

    • ogr2ogr: convert shape file to GeoJSON file

      docker run -it --rm -v $HOME:/data klokantech/gdal ogr2ogr -t_srs EPSG:4326 -f GeoJSON KingCo_2000_Census_BlockGroups.geojson KingCo_2000_Census_BlockGroups.shp -Progress

5. Locate a GeoJSON file

6. Install a Tippecanoe container which is a utility tool to create vector tiles

  • Search for Tippecanoe on Docker Hub
  • Select the jskeates/tippecanoe repository
  • Copy the appropriate command from the Docker Pull Command section of the page
  • Paste it at the Quick Start Terminal prompt, and hit enter to run it

    docker pull jskeates/tippecanoe

7. Create some vector tiles

  • Ensure Docker is running on your computer
  • Start Tippecanoe container in interactive mode at the Quick Start Terminal prompt

    docker run -it -v $HOME:/home/tippecanoe jskeates/tippecanoe:latest

  • You will see your command prompt change to look like bash-4.3$
  • Use the tippecanoe command at the Terminal prompt to create vector tiles from the geoJSON file

    tippecanoe -o KingCo_2000_Census_BlockGroups.mbtiles KingCo_2000_Census_BlockGroups.geojson

  • Exit the container when it is done

    exit

  • The vector tiles will be $HOME/KingCo_2000_Census_BlockGroups.mbtiles
    • $HOME represents your user directory at a unix style command prompt.

8. Install a TileServer GL container

  • Go to Docker Hub
  • Search for tileserver-gl
  • Select klokantech/tileserver-gl
  • Copy the Docker pull command & run it at the Quick Start Terminal prompt

    docker pull klokantech/tileserver-gl

9. Run TileServer GL

  • Ensure Docker is running on your computer
  • From the command line change into the directory cd $HOME where you have placed your mbtiles file

  • Start the TileServer GL container from the Quick Start Terminal prompt

    docker run --rm -it -v $(pwd):/data -p 8080:80 klokantech/tileserver-gl

  • Test that the vector tiles are being served by entering http://192.168.99.100:8080/ into your browser’s address bar

  • After testing, hit ctl-C to quit TileServer GL