Giter Club home page Giter Club logo

mapbox-tileset's Introduction

Mapbox Tilesets API CLI

Operate the tilesets API to upload and generate tilesets for your Mapbox maps.

The tilesets API works with two basic entities: the tileset-source and the tileset. To generate a tile layer for a map, you need to upload one or more files to a tileset-source and then create a "recipe" that specifies which sources at which zoom levels should appear in a generated tileset.

Setup

Mapbox requires an access token with permissions to create, list, delete, etc. the entities that comprise a tileset. Create an account and create an access token with the needed permissions. Pass the username and token to this tool by creating a .env file with these two values:

MAPBOX_USERNAME=abc
MAPBOX_TOKEN=xyz

Alternatively, send the username as a CLI param -u <username> and the token as -t <access_token>.

Check your geometry file

mapbox-tileset source validate <geometry-file>

This checks that

  • each line of the file is valid JSON
  • each point is an array of two numbers
  • the first coordinate of each polygon is the same as the last
  • points are not repeated within a polygon

Create a tileset-source

mapbox-tileset source create <source-id> <geometry-file>

Add data to a tileset-source

mapbox-tileset source create <source-id> <geometry-file-2>

To generate a tileset from a tileset-source, use a recipe to specify which sources will be available at which zoom levels. The recipe for the tileset takes this form:

{
  "name": "My Tileset's Name",
  "recipe": {
    "version": 1,
    "layers": {
      "layer_id": {
        "source": "mapbox://tileset-source/my-username/my-tileset-source",
        "minzoom": 5,
        "maxzoom": 8
      }
    }
  }
}

With an available tileset-source and a recipe.json file like the above example,

Create a tileset

mapbox-tileset tileset create <tileset-id> <recipe.json file>

Finally, to generate the tileset that will be usable in a Mapbox map,

Publish a tileset

mapbox-tileset tileset publish <tileset-id>

This step generates a job that can take quite a while to complete, depending on the number of zoom levels required and how much geographical area is included in the geometry sources.

Check tileset status

mapbox-tileset tileset status <tileset-id>

Other commands:

List available tileset-sources

mapbox-tileset source list

Delete a tileset-source

mapbox-tileset source delete <source-id>

List available tilesets

mapbox-tileset tileset list

Get recipe of a tileset

mapbox-tileset tileset recipe <tileset-id>

Delete a tileset

mapbox-tileset tileset delete <tileset-id>

mapbox-tileset's People

Contributors

jbeuckm avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar  avatar

mapbox-tileset's Issues

Tileset Source Upload Broken

Getting a 500 status. Curl still works so we need to find the difference between what node.https is doing and what curl does.

Check updated API endpoint

Hey there,I'm Maria and I work on the Tilesets API at Mapbox. On February 17th, 2020 we will be changing the "status" endpoint in order to improve the service and according to our logs your account has been using this endpoint actively. We will be removing the summary statistics in the current response and effectively redefining the endpoint to be used for “getting the most recent job for a tileset.”Current response:{  "id": "mapsam.tmp",  "success": 0,  "failed": 0,  "queued": 0,  "processing": 1,  "last_completed_job": "1234"}New response:{  "id": "mapsam.tmp",  "status": "processing",  "latest_job": "1234"}The new response would be the same one you would get by making a request to the /tilesets/v1/{id}/jobs endpoint and getting the first item in the results list. If you rely on any attribute from the current response other than “id,” it will no longer be returned after February 17th.If you need a summary of jobs and their statuses like the current /status endpoint provides, you can use the /jobs endpoint to get a list of all the jobs and then summarize it.This change will be implemented in the API on February 17th, 2020.As always, please let us know if you have any questions or concerns.Best,Maria

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.