Giter VIP home page Giter VIP logo

openstreetmap-vecto's Introduction

OpenStreetMap Vecto

๐Ÿšง ๐Ÿšง Work in progress ๐Ÿšง ๐Ÿšง

OpenStreetMap Vecto is a general-purpose configuration for Baremaps. It is used to generate vector tiles and to produce a Mapbox style inspired by OpenStreetMap Carto.

OpenStreetMap Vecto

Requirements

Getting started

In order to experiment with OpenStreetMap Vecto, you first need to clone the current repository

git clone [email protected]:baremaps/openstreetmap-vecto.git
cd openstreetmap-vecto/

Then, you can start the docker images, import the data, and edit the map with the following commands.

docker-compose up --build -d

This default environment will:

You can override this data loaded by modifying the scripts/import.sh file.

To override settings. Copy the env.sample file to .env and modify env var.

Docker compose setup

A docker container containing a PostGIS database and all the tools required to run Baremaps can be started with docker-compose.

The docker-compose.yml file contains two services: db and app. The former holding a PostgreSQL 13.1 / PostGIS 3.1 database and the latter serving the applicative content, namely baremaps. It's from the app containers that you want to run all baremaps commands to populate the database from data, or to start the web application using some of the commands defined hereunder.

The version of baremaps can be changed via the variable BAREMAPS_VERSION in the env.sample file. To find a specific version of baremaps go to the github release page of the project.

Useful commands

Command Description
docker-compose up --build Run the application in the foreground.
docker-compose up --build --detach Run the application in the background.
docker-compose stop Stop all containers.
docker-compose down Stop and remove all containers (but keep the data).
docker-compose down --volumes Stop and permanently delete all containers and data.
docker-compose down --volumes --remove-orphans Same as previous and remove all dangling containers not defined in the Compose file.
docker-compose exec app <command> Execute a command inside the running app container.
docker-compose exec app bash -c ./scripts/import.sh Execute the import.sh script to populate the database (inside the container).
docker-compose exec app bash -c ./scripts/edit.sh Edit the map (the db must be populated before running that command).
docker-compose ps List running containers.
docker-compose logs --tail 20 -f Print all containers logs to stdout (usefull when they were launched in the background).

Your browser (http://localhost:9090/) should now preview OpenStreetMap Vecto.
Here, the port is 9090, but you will have to use the one you defined in your .env if you changed it. You will also have to change the port and host in tileset.json if you don't use the standard ones.
Notice that a change in the configuration files (tileset.json) will automatically be reloaded by the browser.

Editing the tileset

The configuration format used in the tileset.json file extends the TileJSON specification. Simply put, it adds in the ability to describe the vector_tiles and their content with SQL queries that follow the Postgis dialect.

{
  "tilejson": "2.2.0",
  "tiles": [
    "http://localhost:9090/tiles/{z}/{x}/{y}.mvt"
  ],
  "vector_layers": [
    {
      "id": "aerialway",
      "queries": [
        {
          "minzoom": 14,
          "maxzoom": 20,
          "sql": "SELECT id, tags, geom FROM osm_ways_z${zoom} WHERE tags ? 'aerialway'"
        }
      ]
    }
  ]
}

Editing the style

The configuration format used in the style.json follows the Mapbox style specification. Baremaps integrates Maputnik and most of the modifications will take place in the browser.

Contributing

As a lot remains to be done, contributions and feedbacks are welcome.

Troubleshooting windows

On windows, be careful with line endings (LF), especially when the files are mounted in a docker container.

docker run -d --name osmvecto --publish 5432:5432 --publish 9090:9090 --volume C:\openstreetmap-vecto:/home baremaps/osmvecto:latest
docker exec -ti osmvecto bash -c ./import.sh https://download.geofabrik.de/europe/switzerland-latest.osm.pbf

openstreetmap-vecto's People

Contributors

nicolas-heigvd avatar bchapuis avatar b4l avatar marbesse avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.