npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@alvarcarto/tilewarm

v1.2.1

Published

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

Downloads

53

Readme

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