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.
- Get *.pbf of OpenStreetMap
- Generate *.pbf -> *.mbtiles as MBTiles with OpenMapTiles schema
- Generate *.mbtiles -> /z/x/y/*.pbf
- Deploy /z/x/y/*.pbf to server
- Write TileJSON file of your vector tile server
- Write Mapbox style specification file (style.json) to styling and displaying your vector tiles
- 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