Skip to content

Open-Historical-Map-Labs/openmaptiles

 
 

Repository files navigation

OpenMapTiles Build Status

OpenMapTiles is an extensible and open vector tile schema for a OpenStreetMap basemap. It is used to generate vector tiles for openmaptiles.org and openmaptiles.com.

We encourage you to collaborate, reuse and adapt existing layers and add your own layers or use our approach for your own vector tile project. The repository is built on top of the openmaptiles/tools to simplify vector tile creation.

Styles

You can start from several GL styles supporting the OpenMapTiles vector schema.

🔗 Learn how to create Mapbox GL styles with Maputnik and OpenMapTiles.

We also ported over our favorite old raster styles (TM2).

🔗 Learn how to create TM2 styles with Mapbox Studio Classic and OpenMapTiles.

Schema

OpenMapTiles consists out of a collection of documented and self contained layers you can modify and adapt. Together the layers make up the OpenMapTiles tileset.

🔗 Study the vector tile schema

Develop

To work on OpenMapTiles you need Docker and Python.

Build

Build the tileset.

git clone git@github.com:openmaptiles/openmaptiles.git
cd openmaptiles

# Build the imposm mapping, the tm2source project and collect all SQL scripts
make

Prepare the Database

Now start up the database container.

docker-compose up -d postgres

Import external data from OpenStreetMapData, Natural Earth and OpenStreetMap Lake Labels.

docker-compose run --rm import-water
docker-compose run --rm import-natural-earth
docker-compose run --rm import-lakelines

Run our customized OHM border system, extracting OHM borders to CSV then importing that CSV. The "makecsv" step takes 25 minutes, but the "import" step takes a few seconds.

docker-compose run --rm makecsv-osmborder
docker-compose run --rm import-osmborder

Additional Preprocessing

The SQL file build/ohm_preprocessing.sql has some additional preprocessing steps specific to OpenHistoricalMap, e.g. emptying some data, creating custom fields, ...

psql -h 127.0.0.1 -U openmaptiles openmaptiles -f build/ohm_preprocessing.sql

Import OHM PBF

Download the OpenHistoricalMap planet file, and store the PBF file in the ./data directory. Then Import OpenStreetMap data with the mapping rules from build/mapping.yaml (which has been created by make).

cd data
(instructions TBD)

docker-compose run --rm import-osm

make clean && make

docker-compose run --rm import-sql

Additional Postprocessing

The SQL file build/ohm_postprocessing.sql has some additional postprocessing steps specific to OpenHistoricalMap, e.g. emptying some data, creating custom fields, ...

psql -U openmaptiles openmaptiles -f build/ohm_postprocessing.sql

Vector Tile Rendering with Tessera

npm install tessera @mapbox/tilelive-vector tilelive-tmsource tilelive-xray
node_modules/.bin/tessera tmsource://./build/openmaptiles.tm2source

Updating OHM

A service wrapper runs docker-compose run --rm update-osm constantly, 24x7. As such, there should be no additional intervention necessary. See the openhistoricaltiles repository for more details on this service wrapper.

License

All code in this repository is under the BSD license and the cartography decisions encoded in the schema and SQL are licensed under CC-BY.

Products or services using maps derived from OpenMapTiles schema need to visibly credit "OpenMapTiles.org" or reference "OpenMapTiles" with a link to http://openmaptiles.org/. Exceptions to attribution requirement can be granted on request.

For a browsable electronic map based on OpenMapTiles and OpenStreetMap data, the credit should appear in the corner of the map. For example:

© OpenMapTiles © OpenStreetMap contributors

For printed and static maps a similar attribution should be made in a textual description near the image, in the same fashion as if you cite a photograph.

About

OpenMapTiles Vector Tile Schema Implementation

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PLpgSQL 87.2%
  • Shell 7.3%
  • Makefile 3.4%
  • Python 1.3%
  • TSQL 0.8%