This is an experimental repository, supporting a larger effort to bring web vector tile rendering to Mapeo Desktop.
This repo is a collection of three command line scripts that build the necessary resources to render an osm-p2p-db, plus some additional data, as an interactive mapbox-gl-js web map.
The scripts all take a dataset
parameter, which is a path to a directory.
Here is a listing of the files that need to appear in that dataset directory and where they currently come from:
- Pre-Made
presets.json
: a list of presets, fields, categories, and defaults. This is described by the iD presets format, and concatenated into a single JSON file.icons/
: a directory of SVGs icons, referenced by the presets inpresets.json
.layerify.js
: not generally needed; a hack for one of our datasets (wao), so we can cut up the OSM data into layers dynamically as they are served.osm/
: directory of osm-p2p data. Likely created by Mapeo Desktop.style.json
: a JSON file adhering to the MapBox Style Specification.
- Generated
geo.json
: GeoJSON export of the osm-p2p database. Produced by running theexport.js
script.icons.{json,png}
: Icons of SVG presets, converted into a single PNG sprite sheet. The JSON file describes the names & locations in the spritesheet of each icon. Produced by running thebuild_sprites.js
script.
If you have such a directory, you can generate the GeoJSON and the PNG icons and then serve it up as a website as
$ node build_sprites.js local_parks/
$ node export.js local_parks/
$ node serve.js local_parks/
Serving on http://localhost:9050/
Once all of these files are present in a directory in the root dir of this
repo, node serve.js dataset/
will start a local HTTP server, serving an
interactive web map of the OSM data, presets, & icons provided.
This is still very tedious. This work is meant as a proof-of-concept that we can render vector tiles efficiently for osm-p2p data, and as a base for the future work of integrating vector tile rendering into Mapeo Desktop.