Serving up SpaceNet Imagery for Bokeh

A lightweight codebase for building a local tile server for Bokeh applications

Adam Van Etten
Geodesic
Published in
3 min readMay 10, 2022

--

In our last post we discussed methods for vehicle localization, congestion detection, and optimized routing with the open-source Diet Hadrade repository. Diet Hadrade allows users to experiment with static images within a Jupyter notebook. As we look to build upon this functionality, one critical piece is tiling imagery rather than attempting to deal with large (gigabyte+) images in full. This blog shows how to quickly spin up a tile server with large geospatial data — we focus on SpaceNet, but any Cloud Optimized GeoTIFF (COG) will do. We also show how to use these tiles within Bokeh server, which opens up a world of possibilities regarding interactive dashboards and geospatial applications. We open-source our work with the Bokeh Tiler repository.

1. Tile Servers

Tile servers are by now ubiquitous in society. Tile servers provide a means for users to access enormous images over the web by serving only the regions and zoom levels required at any given instant. Many solutions (e.g. Google Maps) are quite polished and robust, yet require a massive infrastructure footprint.

Spinning up a local tile server in order to explore one’s own imagery is also a common occurrence. There are myriad methods for doing so (e.g. mbtiles), though most require quite a bit of data preparation and the installation of various packages/programs.

The recently released localtileserver is a great option (and the one we will use), as it uses only Python, and happily tiles any COG without any data preparation required.

2. SpaceNet Data

We will use public imagery from the SpaceNet 5 Challenge. These images are part of the Registry of Open Data on AWS, and can be downloaded for free. For this exercise, we’ll explore SpaceNet Area of Interest (AOI) #10: Dar Es Salaam. We’ll download the full COG (25 GB), and convert the image to 8bit for ease of visualization. See here for explicit data preparation commands.

Figure 1. Large (130 million pixel) SpaceNet GeoTIFF of Dar Es Salaam that we aim to tile.

3. Tiling in Jupyter

Spinning up SpaceNet tiles within Jupyter notebook is quite simple:

Figure 2. Presto — tiles within Juypter

4. Tiling for a Bokeh Server

Bokeh servers enable the creation of interactive web applications that connect front-end events to running Python code [1]. Therefore, tiling SpaceNet (or any other) imagery in a Bokeh server is a useful capability if one aims to create an interactive geospatial dashboard. To run a Bokeh server with tiled SpaceNet imagery simply execute:

Figure 3. Tiling the entirety of Dar Es Salaam within Bokeh. [This is running on a 4-year old MacBook Pro.]

5. Conclusions

In this post we showed how to quickly and easily spin up a local tile server for SpaceNet imagery using the open source Bokeh Tiler repository. We leverage the impressive localtileserver repository to accomplish this, and show how to invoke a tile server in Bokeh server. In future posts, we will show how to use SpaceNet Tiler along with deep learning and graph analytics techniques to build a Bokeh application for exploring a variety of evacuation and humanitarian use cases.

--

--