pnorman / openstreetmap-cartographic

A port of OpenStreetMap Carto to Mapbox GL for client-side rendering
Other
58 stars 4 forks source link
mapbox-gl openstreetmap vector-tiles

OpenStreetMap Cartographic

What is it?

A port of OpenStreetMap Carto targeting client-side rendering with vector tiles.

A public demo is available.

How is it different from previous work?

Previous work has used tilelive which is a technical dead-end, used existing vector tile sets which didn't have the richness of OpenStreetMap Data that OpenStreetMap Carto shows, or has not been intended to be a continuation of the OpenStreetMap Carto project.

What do I need to run it?

Install Tilekiln with

python3 -m venv venv
source venv/bin/activate
pip install tilekiln

How do I get some vector tiles?

Install Tilekiln. Generate tiles with tilekiln-generate area -d gis vector.yaml tiles/.

You can't generate for just a bounding box until it is implemented in tilekiln so it helps to have database CPU to throw at this.

Make a TileJSON with information about the tiles with tilekiln-tilejson vector.yaml "http://localhost:8080/tiles/{id}/{z}/{x}/{y}.mvt" > tiles/dev.json

Serve up the tiles with ./serve.py and you'll get a tilejson at http://localhost:8080/tiles/dev.json and the stylesheet at http://localhost:8080/openstreetmap-cartographic.json. Load the stylesheet into something like Fresco for a better editing experience.

If you get fancy and aren't loading tiles from localhost, make sure to set your CORS headers and update the URLs.

Why pre-generate vector tiles?

We're targeting deploying on the scale of tile.openstreetmap.org and pre-generation makes sense there. It's also way easier operationally.

Legal

The code and cartography is licensed under CC0 as described in LICENSE.txt.

OpenStreetMap is a trademark of the OpenStreetMap Foundation, and is used with their permission. This project is not endorsed by or affiliated with the OpenStreetMap Foundation.