This project is a collection of functions and CLI wrapper for interacting with the Mapbox Tile Service.
This project requires Python 3.9 and pipenv
to be installed globally. To start, install all the required libraries on Pipfile.
First, install non dev libraries.
pipenv install
I've added geopandas as dev package since it requires the correct version of GDAL to be installed. To install GDAL, make sure you are inside the virtual environment before running this script:
pipenv shell
sh install_gdal.sh
This will install the necessary libraries for you. The python wrapper will also be installed via pip
.
Lastly, install the dev packages.
pipenv install --dev
A sample environment variable .env.sample
is provided to run this project. Follow these steps to get your Mapbox access token:
- Create a mapbox account here.
- Create a new access token that has the scopes
tilesets:write
,tilesets:read
, andtilesets:list
. Do not share this token! Copy the token value to your env file. - Also add your username to the env.
There are 3 important scripts on the project:
cli_wrapper.py
mapbox_api.py
shp_converter.py
This script contains functions to wrap the tilesets
Mapbox CLI. This is done for us to be able to do bulk operations optimally by using async operations.
Currently,only the area estimation is fully implemented since the rest of integration is done via API.
This script contains functions to interact with the MTS API. The current operations implemented are:
- Creating a tile source by uploading a geojson file. Bulk operation also implemented.
- Create tilesets from a generated recipe.
- Update tileset recipe.
- Publish created tileset.
Converts a directory of shapefiles to geojson which is required by MTS.