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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@acalcutt/contour-generator

v2.0.5

Published

Locally generates contour vector tiles using maplibre-contour

Readme

Contour Generator

Generates contour tiles in Mapbox Vector Tile (MVT) format from terrain raster-dem data using maplibre-contour. It allows maplibre-contour to work with PMTiles (local or HTTP) when the demUrl is prefixed with pmtiles:// and outputs to local MVT tiles.

This script outputs tile files in the <outputDir>/z/x/y.pbf format and generates a <outputDir>/metadata.json file. These files can be imported using mbutil. For example, to import the tiles into an mbtiles file using mbutil, the syntax would be: mb-util --image_format=pbf <outputDir> output.mbtiles.

Script Parameters

Generates contour tiles based on specified function and parameters.

Docker Usage: docker run --rm -v $(pwd):/data wifidb/contour-generator <function> [options]
Local Usage: node . <function> [options] NPM Globally Installed: contour-generator <function> [options]

Functions:

  • pyramid: Generates contours for a parent tile and all child tiles up to a specified max zoom level.
  • zoom: Generates a list of parent tiles at a specified zoom level, then runs pyramid on each of them in parallel.
  • bbox: Generates a list of parent tiles that cover a bounding box, then runs pyramid on each of them in parallel.

General Options

  • --demUrl <string>: The URL of the DEM source (e.g., pmtiles://<http or local file path> or a tile URL pattern like https://<zxyPattern>).
  • --encoding <string>: The encoding of the source DEM tiles (e.g., 'terrarium', 'mapbox'). (default: mapbox)
  • --sourceMaxZoom <number>: The maximum zoom level of the source DEM. (default: 8)
  • --increment <number>: The contour increment value to extract. Use 0 for default thresholds.
  • --outputMaxZoom <number>: The maximum zoom level of the output tile pyramid. (default: 8)
  • --outputDir <string>: The output directory where tiles will be stored. (default: ./output)
  • --processes <number>: The number of parallel processes to use. (default: 8)
  • --blankTileNoDataValue <number>: The elevation value to use for blank tiles when a DEM tile is missing. (default: 0)
  • --blankTileSize <number>: The pixel dimension of the tiles (e.g., 256 or 512). (default: 512)
  • --blankTileFormat <string>: The image format for generated blank tiles ('png', 'webp', or 'jpeg'). This is used as a fallback if the source format cannot be determined. (default: png)
  • -v, --verbose: Enable verbose output.
  • -h, --help: Show this usage statement.

Function-Specific Options

For pyramid:

  • --x <number>: The X coordinate of the parent tile. (Required)
  • --y <number>: The Y coordinate of the parent tile. (Required)
  • --z <number>: The Z coordinate of the parent tile. (Required)

For zoom:

  • --outputMinZoom <number>: The minimum zoom level of the output tile pyramid. (default: 5)

For bbox:

  • --minx <number>: The minimum X coordinate of the bounding box. (Required)
  • --miny <number>: The minimum Y coordinate of the bounding box. (Required)
  • --maxx <number>: The maximum X coordinate of the bounding box. (Required)
  • --maxy <number>: The maximum Y coordinate of the bounding box. (Required)
  • --outputMinZoom <number>: The minimum zoom level of the output tile pyramid. (default: 5)

Use with Docker

This image is published to Docker Hub as wifidb/contour-generator.

The docker image wifidb/contour-generator can be used for generating tiles in different ways.

Docker Examples:

pyramid function (using Docker w/pmtiles https source):

# View Help
 docker run -it -v $(pwd):/data wifidb/contour-generator pyramid --help

# Example
 docker run -it -v $(pwd):/data wifidb/contour-generator \
    pyramid \
    --z 9 \
    --x 272 \
    --y 179 \
    --demUrl "pmtiles://https://acalcutt.github.io/contour_generator/test_data/terrain-tiles.pmtiles" \
    --sourceMaxZoom 12 \
    --encoding mapbox \
    --increment 0 \
    --outputDir "/data/output_pyramid" \
    --outputMaxZoom 15 \
    -v
  
  # Test View Area #9/47.2542/11.5426

zoom function (using Docker w/pmtiles local source):

# View Help
 docker run -it -v $(pwd):/data wifidb/contour-generator zoom --help

# Downlad example test data into your local directory
 wget https://github.com/acalcutt/contour_generator/releases/download/test_data/JAXA_2024_terrainrgb_z0-Z7_webp.pmtiles

# Example
 docker run -it -v $(pwd):/data wifidb/contour-generator \
    zoom \
    --demUrl "pmtiles:///data/JAXA_2024_terrainrgb_z0-Z7_webp.pmtiles" \
    --outputDir "/data/output_zoom" \
    --sourceMaxZoom 7 \
    --encoding mapbox \
    --outputMinZoom 5 \
    --outputMaxZoom 7 \
    --increment 100 \
    --processes 8 \
    --blankTileNoDataValue 0 \
    --blankTileSize 512 \
    --blankTileFormat webp \
    -v
  
  # Test View Area #5/47.25/11.54
  # Note: some "No tile returned for" messages are normal with this JAXA dataset since there are areas without tiles

bbox function (using Docker w/zxyPattern source):

# View Help
 docker run -it -v $(pwd):/data wifidb/contour-generator bbox --help

# Example
 docker run -it -v $(pwd):/data wifidb/contour-generator \
    bbox \
    --minx -73.51 \
    --miny 41.23 \
    --maxx -69.93 \
    --maxy 42.88 \
    --demUrl "https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png" \
    --sourceMaxZoom 15 \
    --encoding terrarium \
    --increment 50 \
    --outputMinZoom 5 \
    --outputMaxZoom 10 \
    --outputDir "/data/output_bbox" \
    -v

  # Test View Area #5/44.96/-73.35

Important Notes:

The -v $(pwd):/data part of the docker run command maps your local working directory $(pwd) to /data inside the Docker container. Therefore, your DEM file must be located in the /data directory inside of the docker image, and the output directory must also be in the /data directory.

Install Locally from git

git clone https://github.com/acalcutt/contour-generator.git
cd contour-generator
npm install

Local Examples:

pyramid function (Run Locally w/pmtiles https source):

# View Help
 node . pyramid --help

# Example
 node . pyramid \
  --z 9 \
  --x 272 \
  --y 179 \
  --demUrl "pmtiles://https://acalcutt.github.io/contour_generator/test_data/terrain-tiles.pmtiles" \
  --sourceMaxZoom 12 \
  --encoding mapbox \
  --increment 0 \
  --outputDir "./output_pyramid" \
  --outputMaxZoom 15 \
  -v

  #Test View Area #9/47.2542/11.5426

zoom function (Run Locally w/pmtiles local source):

# View Help
 node . zoom --help

# Downlad the test data into your local directory
 wget https://github.com/acalcutt/contour_generator/releases/download/test_data/JAXA_2024_terrainrgb_z0-Z7_webp.pmtiles

#Example
 node .  zoom \
  --demUrl "pmtiles://./JAXA_2024_terrainrgb_z0-Z7_webp.pmtiles" \
  --outputDir "./output_zoom" \
  --sourceMaxZoom 7 \
  --encoding mapbox \
  --outputMinZoom 5 \
  --outputMaxZoom 7 \
  --increment 100 \
  --processes 8 \
  -v

  # Test View Area #5/47.25/11.54 
  # Note: some "No tile returned for" messages are normal with this JAXA dataset since there are areas without tiles

bbox function (Run Locally w/zxyPattern source):

# View Help
 node . bbox --help

# Example
 node . bbox \
  --minx -73.51 \
  --miny 41.23 \
  --maxx -69.93 \
  --maxy 42.88 \
  --demUrl "https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png" \
  --sourceMaxZoom 15 \
  --encoding terrarium \
  --increment 50 \
  --outputMinZoom 5 \
  --outputMaxZoom 10 \
  --outputDir "./output_bbox" \
  -v

  # Test View Area #5/44.96/-73.35

Test Data License Information

AWS mapzen terrarium tiles: https://registry.opendata.aws/terrain-tiles/ JAXA AW3D30: https://earth.jaxa.jp/en/data/policy/