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

mapbox-style-downloader

v2.5.4

Published

Download Mapbox styles, sprites, glyphs (fonts) and tiles for offline usage

Downloads

15

Readme

mapbox-style-downloader

Download mapbox styles, tiles, glyphs, and sprites for offline use.

npm install -g mapbox-style-downloader

Usage

To download, you need to get a MapBox API Token. You can get one by signing up for mapbox and requesting a public key from them. It is free. It should start with pk. This is your token to be used with mapbox-style-downloader.

To find out the coordinates for the bounding box of the area you'll be downloading the boundingbox online tool can be used. Use the CSV Copy & Paste option to display the coordinates in the correct format.

To download, use the download command like so:

mapbox-style download mapbox://styles/mapbox/streets-v9 \
  --asar \
  --token='MAPBOX_API_TOKEN' \
  -o styledir \
  -z 8 \
  -Z 13 \
  -b '-60.1364 1.5626 -58.0627 3.475'

You need to provide a Mapbox Style URL as the first argument to download. There are many of them, but this is an example: mapbox://styles/mapbox/streets-v9. You can see the full list on the MapBox website.

Compatibility

For map previews we use the latest open source version of mapbox-gl-js, v1.13.3. If you want to be able to view a preview then you need to configure Mapbox Studio for compatibility with v1.10.0+.

If you want to use the downloaded style in Mapeo Mobile, then in Mapbox Studio you need to configure compatibility with "Maps SDK for Android" set to v9.3.0+.

Note: The template styles provided by Mapbox now in Mapbox Studio are not compatible with the Maps SDK version that we use in Mapeo Mobile. You will need to start with a blank style or with an older style in order to use it in Mapeo Mobile.

Be careful!

This has the capability to send MapBox a lot of requests. Try not to get your token throttled! Make sure you pick reasonable bounding boxes and zoom levels, because the data can get very large, very fast.

Serve styles

To serve the styles, you can use a static http server. MapBox isn't that picky on how you serve your tiles. There is a built-in example with this command-line tool. Just give the path to your styledir like so:

mapbox-style serve styledir

And you will be able to see your map, being served offline from the tiles, sprites, and glyphs you just downloaded.

API

USAGE: mapbox-style <command> [options]

  download STYLE_URL [options]
    -a, --asar          export tile sources as asar archives
    -b, --bounds        bounding box in the form of "lat, lon, lat, lon"
    -o, --output        the output path for the styles
    -z, --minzoom       the minimum zoom for tile downloading [1,16]
    -Z, --maxzoom       the maximum zoom for tile downloading [1,16]
    -t, --token         your MapBox API token
    -u, --minutf        minimum UTF-8 char code to download glyphs for
    -U, --maxutf        maximum UTF-8 char code to download glyphs for
    --style             only download the style.json
    --glyphs            download glyphs
    --tiles             download tiles
    --sprites           download sprites

  By default all resources (style.json, glyphs, tiles and sprites) are downloaded.
  Passing any of the --style, --glyphs, --tiles, --sprites options will result
  in only the resources specified being downloaded. This can be helpful if, for
  example, only the style has changes, but the tile data remains the same, so
  there is no need to download it a second time. Note that the style.json is
  _always_ downloaded, since it is needed to get the URLs for other resources.

  serve
    -p, --port          the port to use for the server

  help
    see this help text