pnorman / openstreetmap-cartographic

A port of OpenStreetMap Carto to Mapbox GL for client-side rendering

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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?

  • PostgreSQL 9.6 + PostGIS. PostGIS 3.0 is strongly recommended.
  • OpenStreetMap data loaded in a database according to the standard OpenStreetMap Carto instructions.
  • Python 3 and Tilekiln 0.0.6 or later

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.

About

A port of OpenStreetMap Carto to Mapbox GL for client-side rendering

License:Other


Languages

Language:HTML 96.7%Language:Python 3.3%