Socket
Book a DemoInstallSign in
Socket

@alvarcarto/tilewarm

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alvarcarto/tilewarm

A command-line tool to warm up your tile server cache

1.2.1
latest
Source
npmnpm
Version published
Maintainers
2
Created
Source

tilewarm

A command-line tool to warm up your tile server cache. Give it a URL template, coordinates, and list of zoom levels and it will systematically request all tile images in the given area.

npm install -g @alvarcarto/tilewarm

Docker example:

docker build -t tilewarm .
docker run tilewarm http://yourtileserver.com/{z}/{x}/{y}.png --input geojson/world.geojson --zoom 1-5

Examples

1-5 levels, 20km radius from the center of Barcelona

tilewarm http://yourtileserver.com/{z}/{x}/{y}.png --point 41.38,2.16 --buffer 20km --zoom 1-5

1-5 levels of the world (~1.3k requests)

tilewarm http://yourtileserver.com/{z}/{x}/{y}.png --input geojson/world.geojson --zoom 1-5

1,3,5 levels of the world (~1k requests)

tilewarm http://yourtileserver.com/{z}/{x}/{y}.png --input geojson/world.geojson --zoom 1,3,5

6-8 levels for all cities in the world (~4k requests)

tilewarm http://yourtileserver.com/{z}/{x}/{y}.png --input geojson/all-cities.geojson --zoom 6-8

6-14 levels for all cities in the world (~1.2M requests)

tilewarm http://yourtileserver.com/{z}/{x}/{y}.png --input geojson/all-cities.geojson --zoom 6-14

15 level for all cities in the world (~3M requests)

tilewarm http://yourtileserver.com/{z}/{x}/{y}.png --input geojson/all-cities.geojson --zoom 15

Usage

Usage: tilewarm <url> [options]

<url>   Tile URL template


Options:
  --verbose             Increase logging              [boolean] [default: false]
  --max-retries         How many times to retry the tile request. The first
                        request is not counted as a retry.          [default: 5]
  --retry-base-timeout  Base timeout defines how many ms to wait before retrying
                        a request. The final wait time is calculated with
                        retryIndex * retryBaseTimeout.           [default: 5000]
  -h, --help            Show help                                      [boolean]
  -p, --point           Center of region (use with -b)                  [string]
  -b, --buffer          Buffer point/geometry by an amount. Affix units at end:
                        mi,km                          [string] [default: "0km"]
  -z, --zoom            Zoom levels (comma separated or range)
                                                       [string] [default: "3-9"]
  -l, --list            Don't perform any requests, just list all tile URLs
                                                      [boolean] [default: false]
  -i, --input           GeoJSON input file              [string] [default: null]
  -c, --concurrency     How many concurrent requests to execute     [default: 5]
  -m, --method          Which HTTP method to use in requests
                                                       [string] [default: "GET"]
  -v, --version         Show version number                            [boolean]

Examples:
  tilewarm http://tileserver.com/{z}/{x}/{y}.png --point 62.31,23.12 --buffer
  10km

Not enough non-option arguments: got 0, need at least 1

Warming cache for all cities in the world

Form a geojson for all cities in the world.

node tools/cities-to-geojson.js tools/cities.csv > cities.geojson

# Put geojson to clipboard, works on Mac
cat cities.geojson | pbcopy

You can debug the geojson by pasting it into http://geojson.io/. The file can be compressed even more with https://www.npmjs.com/package/geojson-precision.

Then run:

tilewarm http://yourtileserver.com/{z}/{x}/{y}.png --input cities.geojson

Zoom levels visually

Each zoom level 3-19.

Contributors

Release

  • Commit all changes.

  • Use np to automate the release:

    np

  • Edit GitHub release notes.

Attribution

This tool is almost a rewrite of tilemantle, which hadn't been updated for a while and had a crash bug for our use case.

License

MIT

Keywords

tile

FAQs

Package last updated on 11 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.