Creating custom tiles

The goal of this section will be to show how to create an mbtiles file from Metropolis-2 Data. At the end we will get a nice Slippy Map that we can show in BlueSky. Read this MapTiler article for more information about zoomable maps.

_images/m2_data.png

The street data came from OpenStreetMap and was downloaded via OSMnx.

The building data comes from the City of Vienna. Please refer to the building data processeing page of Metropolis-2 for more details.

The geofence locations were chosen with OSM at cemetaries, parks, and other green areas of Vienna.

Finally, the airspace border was selected to be an 8 km radius circle centered in the middle of Vienna.

Note

Check out this cool 3d model of our M2 simulation area. With maptiles by MapTiler and OpenStreetMap.

Note that each dataset may contain information about each individual item. In Metropolis-2 we are interested in seeing which buildings or geofences are intruded by aircraft. Therefore we may want to show that information in BlueSky. The geofence and building data is structured as follows:

Geofence and Building data structure

fid

height

geometry

1

250

Polygon

2

500

Polygon

The goal will be to show the fid of the individual building when zoomed in.

Creating the tiles with tippecanoe

OpenMapTiles and TileServer GL both work with the mbtiles specification from mapbox. So we will have to convert our data into this format. QGIS has an algorithm to create vector tiles, however at the time of this tutorial the vector tiles did not render correctly for the street geometry.

Therefore, we will use tippecanoe from mapbox to generate the tiles.

The first step is to convert all datasets into GeoJSON format. This can easily be done with QGIS. It is also important to set the coordinate reference system to EPSG:4326. The four GeoJSON files are saved in the project_data directory.

The second step is to create the tiles with the tippecanoe command. The documentation shows the many different options of the command. For this tutorial, run the command below from the root directory of bluesky-maptiles-docs to create m2.mbtiles to zoom level 20.

tippecanoe -o m2.mbtiles -z20 project_data/*.geojson

If it all goes well you should get the following output and the m2.mbtiles ready to go.

_images/tippecanoe.png