This tutorial shows the steps needed to upload tiles in GeoPackage or MBTiles to MapTiler Cloud using the command-line utility.
Getting the token
In order to successfully upload your resources, you will need to acquire your own token for authentication and the command-line utility. Navigate to the “Credentials“ section of your account administration and create new credentials if you have not done so yet.
After creating the credentials you will be able to copy the token:
Using the CLI utility
You will need Python 3 environment on your machine to use this utility. We are going to start off with an empty project, but the steps will be similar if you are integrating this utility into an existing project.
We will be using standard Python tools: virtual environment and pip, you can alternatively use a different package manager like Poetry.
1. Creating a virtual environment
Let’s make sure you are using the right version of python by running
python -V, the output should indicate Python => 3.6, in our case it's
If not, please follow the directions for how to install it on python.org.
Now we are going to create our project folder and make a virtual environment inside of it:
You should be able to see the newly created folder
test_cli_venv inside the project folder.
2. Installing the maptiler-cloud-cli
We are going to source the virtual environment and install
maptiler-cloud-cli inside of it.
3. Uploading your tiles
This code snippet assumes that your desired file is placed in the project directory however, you could use an absolute path to reference files outside the project folder.
If you want to automate the uploading of your assets to MapTiler Cloud or just don’t want to bother with using the browser interface, we have developed a
maptiler-cloud-cli utility to serve your needs.