Skip to content
Mapbox Pack Guide

Start Here

The goal of this pack is to mirror various Mapbox APIs as closely as possible so that you meaningfully integrate geospatial data into your docs and manage Mapbox projects. The formulas provided interact with Mapbox web services across their , ,
, and Account APIs.
The quickest way to learn how to use this pack is to
Copy this doc
and explore the examples. Before you can interact with the formulas you’ll need to supply your own Mapbox credentials. It mirrors the Mapbox API Playgrounds and includes tool-tips with documentation for most parameters.
Usage Tips
This design is closer to a full-fledged client which allows for a lot of functionality and flexibility, but as a consequence some formulas have a LOT of parameters compared to other packs. Here are some tips to flatten the learning curve with this pack and get up and running quickly.
Many formulas can be run with zero or only a few required parameters
Sensible defaults are provided for most parameters
If a formula is not behaving as expected be sure that you are setting desired parameters to override the default
The Map() formula is a great example because it will work without any parameters, but centers around the default location.
Use named parameters whenever possible.
Formulas in this pack take as many as 19 parameters..using named parameters makes it a lot easier to understand what values are doing.
Take advantage of autocomplete
Small subsets of possible values have autocomplete enabled
Dynamic options like Styles and Tilesets from your studio will autocomplete
Some formulas that require a single coordinate pair also have a search parameter you can use instead of latitude/longitude parameters. This allows you to search from within the formula editor.
A caveat is that coda autocomplete struggles input that isn’t letters, like numbers. I am hoping this improves but for now this feature is better suited for looking up a cities and points of interest than a street address.
Use the GetOptions() formula for parameters with a large set of specific values, such as country codes.
Availability is indicated in parameter documentation
Reference the docs
Check parameters and formulas for documentation
Mapbox API docs can be found
Checkout the Mapbox
Several Mapbox endpoints have a limit of 8,192 characters, this can cause issues when using large geoJSON features (like an isochrone) for a parameter.
In these cases it’s recommended to add features to a Tileset and then serve from a custom style.
It is not possible to integrate Mapbox GL within Coda docs.
Displaying a map is limited to Embedded HTML and Static Images, which have limited interactivity
It’s recommended to use an external tool such as , etc. when you need a map to create features.

A Quick Note on Tokens

Mapbox makes use of public and secret tokens alike so that access can be scoped to desired resources only. You'll want to set up this pack with a secret token and you can add scopes as necessary depending on the formulas you are using. StaticImage and Map formulas cannot use this token because it will be exposed in a URL. There are three ways to address this.

1) The default behavior is to use your account's default public token and requires no action on your part (provided your secret token used to set up the pack has the token:read scope enabled).

2) Create a dedicated public token expecially for use within coda docs. The minimum scopes it will need for the Map and StaticImage formulas are styles:tiles and styles:read, recommended for Free and Pro coda users.

3) Alternatively you can by leverage temporary tokens. These tokens expire after an hour and can be refreshed accordingly. The provided GetToken formula requires your secret token to have the tokens:write scope enabled and creates a token that is valid for 15 to 60 minutes. You can connect a control like the one below to an Automation that generates a new temp token hourly, recommended for Team and Enterprise users with public facing docs.

temporary token

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
) instead.