Skip to content

Commit 92105a5

Browse files
committed
add documentation on large file uploads and reformatting
1 parent cfb8d37 commit 92105a5

File tree

1 file changed

+74
-67
lines changed

1 file changed

+74
-67
lines changed

README.md

Lines changed: 74 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ CLI for interacting with and preparing data for the [Mapbox Tiling Service](http
66

77
📚 If you have a question that isn't answered here, please refer to the complete [Mapbox Tiling Service documentation](https://docs.mapbox.com/mapbox-tiling-service/overview/).
88

9-
109
# Contributing
1110

1211
[CONTRIBUTING.md](/CONTRIBUTING.md) includes information about release processes & running tests. :raised_hands:
@@ -21,68 +20,72 @@ CLI for interacting with and preparing data for the [Mapbox Tiling Service](http
2120
## Basic installation
2221

2322
`pip install mapbox-tilesets` will install everything but [`estimate-area`](#estimate-area).
23+
2424
## Installing optional `estimate-area` command
25+
2526
If you are using an x86 Mac or Linux machine, run:
2627
`pip install 'mapbox-tilesets[estimate-area]'`
2728

2829
Otherwise, you will need to install some dependencies.
2930

3031
### arm64 MacOS
32+
3133
If you're on an arm64 Mac (e.g., with an M1 chip), you'll need to install [GDAL](https://gdal.org/) first. On Mac, a simple way is to use [Homebrew](https://brew.sh/):
34+
3235
```sh
3336
$ brew install gdal
3437
...
3538
$ pip install 'mapbox-tilesets[estimate-area]'
3639
```
3740

3841
### Windows
42+
3943
Note, Windows is not officially supported at this time.
4044

4145
Windows users need to install [GDAL](http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal) and [rasterio](http://www.lfd.uci.edu/~gohlke/pythonlibs/#rasterio).
4246
Then `pip install 'mapbox-tilesets[estimate-area]'`
4347

44-
45-
4648
## Mapbox Access Tokens
4749

4850
In order to use the tilesets endpoints, you need a Mapbox Access Token with `tilesets:write`, `tilesets:read`, and `tilesets:list` scopes. This is a secret token, so do not share it publicly!
4951

5052
You can either pass the Mapbox access token to each command with the `--token` flag or export it as an environment variable. Acceptable values are:
5153

52-
* `MAPBOX_ACCESS_TOKEN`
53-
* `MapboxAccessToken`
54+
- `MAPBOX_ACCESS_TOKEN`
55+
- `MapboxAccessToken`
5456

5557
Set the environment variable with `export`
58+
5659
```
5760
export MAPBOX_ACCESS_TOKEN=my.token
5861
```
5962

6063
# Commands
6164

62-
* Tileset Sources
63-
* [`upload-source`](#upload-source)
64-
* *deprecated* [`add-source`](#deprecated-add-source)
65-
* [`validate-source`](#validate-source)
66-
* [`view-source`](#view-source)
67-
* [`list-sources`](#list-sources)
68-
* [`delete-source`](#delete-source)
69-
* [`estimate-area`](#estimate-area)
70-
* Recipes
71-
* [`view-recipe`](#view-recipe)
72-
* [`validate-recipe`](#validate-recipe)
73-
* [`update-recipe`](#update-recipe)
74-
* Tilesets
75-
* [`create`](#create)
76-
* [`publish`](#publish)
77-
* [`update`](#update)
78-
* [`delete`](#delete)
79-
* [`status`](#status)
80-
* [`job`](#job)
81-
* [`jobs`](#jobs)
82-
* [`list`](#list)
83-
* [`tilejson`](#tilejson)
84-
* Activity
85-
* [`list-activity`](#list-activity)
65+
- Tileset Sources
66+
- [`upload-source`](#upload-source)
67+
- _deprecated_ [`add-source`](#deprecated-add-source)
68+
- [`validate-source`](#validate-source)
69+
- [`view-source`](#view-source)
70+
- [`list-sources`](#list-sources)
71+
- [`delete-source`](#delete-source)
72+
- [`estimate-area`](#estimate-area)
73+
- Recipes
74+
- [`view-recipe`](#view-recipe)
75+
- [`validate-recipe`](#validate-recipe)
76+
- [`update-recipe`](#update-recipe)
77+
- Tilesets
78+
- [`create`](#create)
79+
- [`publish`](#publish)
80+
- [`update`](#update)
81+
- [`delete`](#delete)
82+
- [`status`](#status)
83+
- [`job`](#job)
84+
- [`jobs`](#jobs)
85+
- [`list`](#list)
86+
- [`tilejson`](#tilejson)
87+
- Activity
88+
- [`list-activity`](#list-activity)
8689

8790
### upload-source
8891

@@ -94,11 +97,13 @@ Uploads GeoJSON files to a source for tiling. Accepts line-delimited GeoJSON or
9497

9598
Please note that if your source data is a FeatureCollection, `tilesets` must read it all into memory to split it up into separate features before uploading it to the Tilesets API. You are strongly encouraged to provide your data in line-delimited GeoJSON format instead, especially if it is large.
9699

100+
Note: for large file uploads that are taking a very long time, try using the `--no-validation` flag.
101+
97102
Flags:
98103

99-
* `--no-validation` [optional]: do not validate source data locally before uploading
100-
* `--replace` [optional]: delete all existing source data and replace with data from the file
101-
* `--quiet` [optional]: do not display an upload progress bar
104+
- `--no-validation` [optional]: do not validate source data locally before uploading, can be helpful for large file uploads
105+
- `--replace` [optional]: delete all existing source data and replace with data from the file
106+
- `--quiet` [optional]: do not display an upload progress bar
102107

103108
Usage
104109

@@ -114,9 +119,9 @@ tilesets upload-source <username> <source_id> file-1.geojson file-4.geojson
114119
tilesets upload-source <username> <source_id> ./path/to/multiple/files/
115120
```
116121

117-
### *deprecated* add-source
122+
### _deprecated_ add-source
118123

119-
*WARNING: add-source is maintained for legacy purposes. Please use the `upload-source` command instead.*
124+
_WARNING: add-source is maintained for legacy purposes. Please use the `upload-source` command instead._
120125

121126
```shell
122127
tilesets add-source <username> <source_id> <file>
@@ -128,8 +133,8 @@ Please note that if your source data is a FeatureCollection, `tilesets` must rea
128133

129134
Flags:
130135

131-
* `--no-validation` [optional]: do not validate source data locally before uploading
132-
* `--quiet` [optional]: do not display an upload progress bar
136+
- `--no-validation` [optional]: do not validate source data locally before uploading
137+
- `--quiet` [optional]: do not display an upload progress bar
133138

134139
Usage
135140

@@ -183,7 +188,7 @@ Permanently delete a tileset source and all of its files. This is not a recovera
183188

184189
Flags:
185190

186-
* `-f` or `--force`: Do not ask for confirmation before deleting
191+
- `-f` or `--force`: Do not ask for confirmation before deleting
187192

188193
Usage
189194

@@ -192,7 +197,7 @@ Usage
192197
tilesets delete-source user source_id
193198
```
194199

195-
### estimate-area
200+
### estimate-area
196201

197202
```shell
198203
tilesets estimate-area <features> -p/--precision <precision>
@@ -202,9 +207,9 @@ Estimates tiled area (km<sup>2</sup>) of features with a specified precision. Ac
202207

203208
Flags:
204209

205-
* `-p` or `--precision` [required]: precision level
206-
* `--no-validation` [optional]: do not validate source data locally before area calculation
207-
* `--force-1cm` [optional]: the --force-1cm flag must be present to enable 1cm precision area calculation and may take longer for large feature inputs or data with global extents. 1cm precision for tileset processing is only available upon request after contacting [Mapbox support](https://support.mapbox.com/hc/en-us/requests/new?ticket_form_id=360000291231)
210+
- `-p` or `--precision` [required]: precision level
211+
- `--no-validation` [optional]: do not validate source data locally before area calculation
212+
- `--force-1cm` [optional]: the --force-1cm flag must be present to enable 1cm precision area calculation and may take longer for large feature inputs or data with global extents. 1cm precision for tileset processing is only available upon request after contacting [Mapbox support](https://support.mapbox.com/hc/en-us/requests/new?ticket_form_id=360000291231)
208213

209214
Usage
210215

@@ -219,9 +224,9 @@ tilesets estimate-area -p <precision> < ./file.geojson
219224
# GeoJSON features in stdin redirection 2
220225
cat ./file.geojson | tilesets estimate-area -p <precision>
221226

222-
# GeoJSON features in stdin stream
227+
# GeoJSON features in stdin stream
223228
tilesets estimate-area --precision <precision>
224-
<features>
229+
<features>
225230

226231
# coordinate pairs (must be in quotes)
227232
tilesets estimate-area "[lng,lat]" "[lng,lat]" --precision <precision>
@@ -244,6 +249,7 @@ tilesets validate-recipe /path/to/recipe.json
244249
```
245250

246251
Example `recipe.json`:
252+
247253
```
248254
{
249255
"version": 1,
@@ -256,6 +262,7 @@ Example `recipe.json`:
256262
}
257263
}
258264
```
265+
259266
See more details about the recipe spec [here](https://docs.mapbox.com/help/troubleshooting/tileset-recipe-reference).
260267
See recipe examples [here](https://docs.mapbox.com/help/troubleshooting/tileset-recipe-examples).
261268

@@ -287,16 +294,16 @@ Creates a brand new, empty tileset with a recipe passed in from your local files
287294
```shell
288295
tilesets create <tileset_id> --recipe /path/to/recipe.json --name "My neat tileset"
289296
```
290-
The `tileset_id` is in the form of `username.handle` - for example "mapbox.neat-tileset". The handle may only include "-" or "\_" special characters and must be 32 characters or fewer.
291297

298+
The `tileset_id` is in the form of `username.handle` - for example "mapbox.neat-tileset". The handle may only include "-" or "\_" special characters and must be 32 characters or fewer.
292299

293300
Flags:
294301

295-
* `--recipe` or `-r` [required]: path to your Recipe JSON document
296-
* `--name` or `-n` [required]: human-readable name of your tileset. (If your tileset_id is user.my_amazing_tileset, you might want your `name` field to be "My Amazing Tileset".)
297-
* `--description` or `-d`: description of your tileset
298-
* `--privacy` or `-p`: Set the privacy of the tileset. Allowed values are `private` and `public`. By default, new tilesets are private.
299-
* `--attribution` or `-a` [optional]: set tileset attribution. Must be a JSON string, specifically an array of attribution objects, each with `text` and `link` keys. Limited to three attribution objects, 80 characters maximum combined across all text values, and 1000 characters maximum combined across all link values.
302+
- `--recipe` or `-r` [required]: path to your Recipe JSON document
303+
- `--name` or `-n` [required]: human-readable name of your tileset. (If your tileset_id is user.my_amazing_tileset, you might want your `name` field to be "My Amazing Tileset".)
304+
- `--description` or `-d`: description of your tileset
305+
- `--privacy` or `-p`: Set the privacy of the tileset. Allowed values are `private` and `public`. By default, new tilesets are private.
306+
- `--attribution` or `-a` [optional]: set tileset attribution. Must be a JSON string, specifically an array of attribution objects, each with `text` and `link` keys. Limited to three attribution objects, 80 characters maximum combined across all text values, and 1000 characters maximum combined across all link values.
300307

301308
### publish
302309

@@ -322,10 +329,10 @@ tilesets update <tileset_id>
322329

323330
Flags:
324331

325-
* `--name` or `-n` [optional]: update tileset name
326-
* `--description` or `-d` [optional]: update tileset description
327-
* `--privacy` or `-p` [optional]: set your tileset to `public` or `private`
328-
* `--attribution` or `-a` [optional]: set tileset attribution. Must be a JSON string, specifically an array of attribution objects, each with `text` and `link` keys. Limited to three attribution objects, 80 characters maximum combined across all text values, and 1000 characters maximum combined across all link values.
332+
- `--name` or `-n` [optional]: update tileset name
333+
- `--description` or `-d` [optional]: update tileset description
334+
- `--privacy` or `-p` [optional]: set your tileset to `public` or `private`
335+
- `--attribution` or `-a` [optional]: set tileset attribution. Must be a JSON string, specifically an array of attribution objects, each with `text` and `link` keys. Limited to three attribution objects, 80 characters maximum combined across all text values, and 1000 characters maximum combined across all link values.
329336

330337
### delete
331338

@@ -337,7 +344,7 @@ tilesets delete <tileset_id>
337344

338345
Flags:
339346

340-
* `--force` or `-f` to bypass confirmation prompt.
347+
- `--force` or `-f` to bypass confirmation prompt.
341348

342349
### status
343350

@@ -371,8 +378,8 @@ tilesets jobs <tileset_id> --stage=processing
371378

372379
Flags:
373380

374-
* `--stage` [optional]: filter by the stage of jobs
375-
* `--limit [1-500]` [optional]: the maximum number of results to return, from 1 to 500. The default is 100.
381+
- `--stage` [optional]: filter by the stage of jobs
382+
- `--limit [1-500]` [optional]: the maximum number of results to return, from 1 to 500. The default is 100.
376383

377384
### list
378385

@@ -384,11 +391,11 @@ tilesets list <username>
384391

385392
Flags:
386393

387-
* `--type [vector|raster]` [optional]: filter results by tileset type
388-
* `--visibility [public|private]` [optional]: filter results by visibility
389-
* `--sortby [created|modified]` [optional]: sort results by their `created` or `modified` timestamps
390-
* `--limit [1-500]` [optional]: the maximum number of results to return, from 1 to 500. The default is 100.
391-
* `--verbose` [optional]: will list out the entire response object from the API
394+
- `--type [vector|raster]` [optional]: filter results by tileset type
395+
- `--visibility [public|private]` [optional]: filter results by visibility
396+
- `--sortby [created|modified]` [optional]: sort results by their `created` or `modified` timestamps
397+
- `--limit [1-500]` [optional]: the maximum number of results to return, from 1 to 500. The default is 100.
398+
- `--verbose` [optional]: will list out the entire response object from the API
392399

393400
### tilejson
394401

@@ -402,7 +409,7 @@ tilesets tilejson <tileset_id>
402409

403410
Flags:
404411

405-
* `--secure`: By default, resource URLs in the retrieved TileJSON (such as in the "tiles" array) will use the HTTP scheme. Include this query parameter in your request to receive HTTPS resource URLs instead.
412+
- `--secure`: By default, resource URLs in the retrieved TileJSON (such as in the "tiles" array) will use the HTTP scheme. Include this query parameter in your request to receive HTTPS resource URLs instead.
406413

407414
### list-activity
408415

@@ -414,8 +421,8 @@ tilesets list-activity <account>
414421

415422
Flags:
416423

417-
* `--sortby [requests|modified]` [optional]: Sorting key (default: requests)
418-
* `--orderby [asc|desc]` [optional]: Ordering key (default: desc)
419-
* `--limit [1-500]` [optional]: The maximum number of results to return (default: 100)
420-
* `--indent` [optional]: Indent size for JSON output.
421-
* `--start` [optional]: Pagination key from the `next` value in a response that has more results than the limit.
424+
- `--sortby [requests|modified]` [optional]: Sorting key (default: requests)
425+
- `--orderby [asc|desc]` [optional]: Ordering key (default: desc)
426+
- `--limit [1-500]` [optional]: The maximum number of results to return (default: 100)
427+
- `--indent` [optional]: Indent size for JSON output.
428+
- `--start` [optional]: Pagination key from the `next` value in a response that has more results than the limit.

0 commit comments

Comments
 (0)