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

mbtiles2tilejson

v0.0.3

Published

Generate a TileJSON file from MBTiles file

Downloads

6

Readme

mbtiles2tilejson

This is a npm package that generate TileJSON file from MBTiles file.

Known Limitation

Currently this npm package support TileJSON Specification 2.0 only.

Why?

When you want to create your own vector tile web maps, TileJSON file is pretty important.
Because url of TileJSON is required to create your own Mapbox style specification.

Nowadays, there has been an industry standard produce process for creating your own vector tile web maps.

  1. Get *.pbf of OpenStreetMap
  2. Generate *.pbf -> *.mbtiles as MBTiles with OpenMapTiles schema
  3. Generate *.mbtiles -> /z/x/y/*.pbf
  4. Deploy /z/x/y/*.pbf to server
  5. Write TileJSON file of your vector tile server
  6. Write Mapbox style specification file (style.json) to styling and displaying your vector tiles
  7. Write HTML/CSS/JS that load and draw the maps based on style.json

If you have a lot money, you can keep running server that can dynamically generate /z/x/y/*.pbf from MBTiles file.
Those MBTiles server also has capabilities to dynamically generate TileJSON file from MBTiles file.
But if you are trying to extremely save money, you will want to serve /z/x/y/*.pbf files on static web server.

My findings is that there is no good tools to just generate custom TileJSON from MBTiles.

I do not want to serve MBTiles.
I want to just generate TileJSON.

(... I'm also feeling some pain with step 6, but I'd like to solve that with another tool)

If you interested to create your own vector tile web maps,
You can see detail on https://scrapbox.io/yuiseki/How_to_create_your_own_vector_tile_web_maps

Install

Install as a command:

npm i -g mbtiles2tilejson

Install as a package:

npm i mbtiles2tilejson

Usage

MBTiles file path and URL option are required.

mbtiles2tilejson path/to/region.mbtiles --url http://localhost:3000/ > path/to/tiles.json

Development

npm ci
npm run build
npm link