How to prepare map data for a global population density map
This tutorial is part of a series that describes how to build a map showing the global population density changes over time.
Before you start
First, you need to prepare a GeoTiff file containing the population data. Please follow a separate tutorial explaining how to prepare gridded raster data in GeoTiff format for the visualization.
Tile your data
If you followed the exact steps in the prep tutorial, you’ve got a GeoTiff file named density_2000_sqrt.tif
as output, which contains the global population data for the year 2000. The steps below guide you through the tiling process so that the file can be used to build the map.
-
Open the
density_2000_sqrt.tif
file in MapTiler Engine. Once it loads, you can view its properties. -
Proceed to specify the data scaling values for each image band. If the dialog doesn’t pop up automatically, open it via the Bands menu > Change bands.
-
Indicate the minimum and maximum values for each band. The values that we will use are Min = 0 and Max = 255 for each band. For the alpha channel, select the option to ignore the alpha channel.
-
Select MBTiles as the output format.
-
Configure the output tile settings:
- Select no transparency (basemap).
- Set the compression to PNG.
- Set the maximum zoom level to 7.
-
Select the name and location of the output file.
-
In the upload options, select Upload to MapTiler Cloud.
-
If you’re not signed in to MapTiler Cloud already, you’ll be asked for authentication. You can also review and adjust the name of the output file which will be used in the Cloud.
-
MapTiler Engine starts processing the file and you can watch the status and progress. Once it’s done, go to Options > Output preview.
The completed tileset is now available in the My tiles section of your MapTiler Cloud account.
Tile your data using CLI
If you prefer the command-line interface of MapTiler Engine, here’s how to generate the desired .mbtiles file:
maptiler-engine -f png -o density_2000_sqrt-png.mbtiles density_2000_sqrt.tif -zoom 0 7 -data_scale 255
Once the tiling is complete, upload the tileset to MapTiler Cloud. If you’d like to automate the entire process, use the MapTiler Cloud Upload API.
Next steps
Now you’ve tiled the GeoTiff file containing data for the year 2000. To get a complete set for the data visualization, repeat the described process for years 2005, 2010, 2015, and 2020.
When you have all five tilesets ready in MapTiler Cloud, build the visualization using the MapTiler SDK JS as described in the tutorial Visualize and animate the evolution of population data.