Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 13 Current »

This tool lets you easily create or update vector tilesets on Mapbox from your CSV files using command line. It can be especially handy if you need to periodically update some vector tileset (e.g. every day updates). It is alternative for Mapbox Studio where you can do almost same things manually. Under the hood the tool is using Mapbox Python API, ogr2ogr and tippecanoe utilites. Just pass your CSV file with WKT geometries, specify some parameters and you are done. 

Installation

MapboxUtils is available as Keboola Connection Component and it is available to registered Keboola users. You have to be logged in your Keboola project (https://connection.keboola.com) to use it. To open SpatialUtils just go to Applications, choose New Application and write "MapboxUtils" into the search bar. Then choose CleverMaps MapboxUtils

Configuration

With the MapboxUtils application opened, choose New Configuration and fill in the form.

Firstly, you need to specify input and output mappings.

  • Table Input Mapping

    • Choose New Table Input and specify a table with your data which you want to process. 

  • Table Output Mapping

    • Choose New Table Output and create a new empty table where the results will be stored.

Secondly you need to pass a configuration JSON into MapboxUtils. Please check availalble parameters and the example below to get the idea how the configuration file should look.

Available parameters

name

mandatory

example

description

input_pkey_column

yes

input_pkey_column: id

Name of the primary key column

input_geom_column

yes

input_geom_column: wkt

Name of geometry column

tileset_map_id

no

tileset_map_id: cleveranalytics.14j1fhp2

Mapbox tilesetmapid. If not specified than random value is generated by Mapbox. Specify in case of updating an existing tileset.

tileset_name

no

tileset_name: countries_wkt-02ssft

Mapbox tilesetname. If not than specified than tilesetname is generated as combination of input file name and random hash. Specify in case of updating an existing tileset or if you need your own tilesetname. 

layer_name

no

layer_name: countries_wkt

Mapbox layername. If not specified than same value as tilesetname is used. Specify in case of updating an existing tileset or if you need your own layername. 

zoom_min

no

zoom_min: 5

Minimal zoom of the tileset

zoom_max

no

zoom_max: 10

Maximal zoom of the tileset. Maximum allowed value is 10.

mbtiles_params

no

mbtiles: ["drop-densest-as-needed", "extend-zooms-if-still-dropping"]

Parameters of MBTiles generation internally used by tippecanoe. Parameters can be found here https://github.com/mapbox/tippecanoe

#mapboxtoken

yes

#mapboxtoken: abcdefgah1234

Your Mapbox account token. Token needs to have following priviliges: TILESETS:WRITE, TILESETS:READ, TILESETS:LIST, UPLOADS:READ, UPLOADS:WRITE. Check https://docs.mapbox.com/help/how-mapbox-works/access-tokens/ for more information.

Creating a new vector tileset

{
  "input_pkey_column": "id",
  "input_geom_column": "polygon",
  "#mapbox_token": "your mapbox token",
  "zoom_min": "4",
  "zoom_max": "10"
}

Updating an existing vector tileset with optional mbtiles paramaters

{
  "input_pkey_column": "id",
  "input_geom_column": "polygon",
  "tileset_name": "restaurants_time_zones-d0c283".
  "tileset_map_id": "cleveranalytics.d0c283",
  "#mapbox_token": "your mapbox token",
  "zoom_min": "4",
  "zoom_max": "10",
  "mbtiles_params": [
    "drop-densest-as-needed",
    "extend-zooms-if-still-dropping"
  ]
}


  • No labels