7.8.0 • Published 10 months ago

@mapbox/mapbox-tile-copy v7.8.0

Weekly downloads
11
License
ISC
Repository
github
Last release
10 months ago

mapbox-tile-copy

A shortcut from local geodata files to tiles on S3 or to the local filesystem.

Build Status

Installation

$ npm install -g @mapbox/mapbox-tile-copy

Configuration

If writing to S3 you'll need to make sure that your shell environment is configured with appropriate credentials.

Usage

$ mapbox-tile-copy <file> <s3:// url template or file:// path>

Your s3 url template must include a {z}/{x}/{y} scheme for writing and distributing tiles. File extensions are not required.

Examples:

Copy tiles from an mbtiles file to a folder in my-bucket:

$ mapbox-tile-copy ~/data/my-tiles.mbtiles s3://my-bucket/folder/mbtiles/{z}/{x}/{y}

Copy tiles from an mbtiles file to a relative folder in the current working directory named 'tiles':

$ mapbox-tile-copy ~/data/my-tiles.mbtiles file://./tiles

Convert a GeoJSON file into vector tiles:

$ mapbox-tile-copy ~/data/my-data.geojson s3://my-bucket/folder/geojson/{z}/{x}/{y}

Copy tiles from one S3 location to another via tilejson describing the source:

$ mapbox-tile-copy ~/data/online-data.tilejson s3://my-bucket/folder/tilejson/{z}/{x}/{y}

Render image tiles from vector tiles, using custom fonts from a location on your computer:

$ MapboxTileCopyFonts=/path/to/font/dir mapbox-tile-copy ~/style.tm2z s3://my-bucket/pngs/{z}/{x}/{y}

Perform a part of a copy operation. Useful for parallel processing a large file:

$ mapbox-tile-copy ~/data/my-tiles.mbtiles s3://my-bucket/parallel/{z}/{x}/{y} --part 2 --parts 12

The --part operation is explicitly zero-indexed because this gives tilelive's stream processors a predictable way to segment tiles per part. For example, the following will distribute all tiles among a single part. So all tiles will be rendered by this single part:

$ mapbox-tile-copy ~/data/my-tiles.mbtiles s3://my-bucket/parallel/{z}/{x}/{y} --part 0 --parts 1

The following example will distribute tiles to the second part out of 4 total parts:

$ mapbox-tile-copy ~/data/my-tiles.mbtiles s3://my-bucket/parallel/{z}/{x}/{y} --part 1 --parts 4

You can add extra parameters supported by tilelive-s3 onto the end of the S3 URL. For instance, to extend the default HTTP timeout of 2000ms:

$ mapbox-tile-copy ~/data/my-tiles.mbtiles s3://my-bucket//{z}/{x}/{y}?timeout=10000

Collect tile size statistics and dump to your local tmp dir named /tmp/<tmpdirpath>/tilelive-bridge-stats.json

$ BRIDGE_LOG_MAX_VTILE_BYTES_COMPRESSED=1 mapbox-tile-copy ~/data/my-tiles.mbtiles s3://my-bucket/folder/mbtiles/{z}/{x}/{y}

Supported file types

  • .mbtiles
  • .tilejson
  • .tm2z
  • .kml
  • .geojson
  • .gpx
  • .csv
  • .shp
  • .tif
  • .vrt
  • serialtiles

Running tests

Tests involve copying files to S3. You can bring your own bucket by specifying a TestBucket environment variable.

$ TestBucket=my-bucket npm test

If you don't specify a bucket, it will attempt to write to a private Mapbox bucket, and will fail if your environment is not configured with appropriate credentials.

7.8.0

10 months ago

7.7.1-dev.1

10 months ago

7.7.1-dev3

3 years ago

7.7.1-dev4

3 years ago

7.7.1-dev2

3 years ago

7.7.1-dev1

3 years ago

7.7.0

4 years ago

7.7.0-dev1

4 years ago

7.6.0

4 years ago

7.6.0-dev1

4 years ago

7.5.1

4 years ago

7.5.0

4 years ago

7.4.0

4 years ago

7.3.3

4 years ago

7.4.0-dev1

4 years ago

7.3.2

5 years ago

7.3.1

5 years ago

7.3.1-dev

5 years ago

7.3.0

6 years ago

7.3.0-2

6 years ago

7.3.0-1

6 years ago

7.2.0

6 years ago

7.1.0

6 years ago

7.0.1

6 years ago

7.0.0

6 years ago

6.8.0

6 years ago

6.7.0

6 years ago

6.6.0

6 years ago

6.5.0

6 years ago

6.4.0

7 years ago

6.3.0

7 years ago

6.2.1

7 years ago

6.2.0

7 years ago

6.1.0

7 years ago

6.0.2

7 years ago

6.0.1

7 years ago

6.0.0

7 years ago

5.1.1

7 years ago