Skip to content

Latest commit

 

History

History
55 lines (36 loc) · 2.07 KB

DOCKER.md

File metadata and controls

55 lines (36 loc) · 2.07 KB

WARNING: This is outdated!!!

Setting up development environment using Docker

Requirements

  • Docker

Initial setup

Create project directory:

mkdir freemap-mapnik
cd freemap-mapnik

Install Docker and from the project home directory (freemap-mapnik) run the following commands:

# create network
docker network create --driver bridge freemap-bridge

# prepare volume for PostgreSQL
docker volume create pgdata

# start database
docker run --rm --name=freemap-postgis -v pgdata:/var/lib/postgresql/data --network=freemap-bridge -e POSTGRES_PASSWORD=secret -d mdillon/postgis

# clone the project and prepare map data (Slovakia)
docker run --rm --name=freemap-mapnik -v $(pwd):/freemap-mapnik --network=freemap-bridge -p 4000:4000 -w /freemap-mapnik -it zdila/freemap-mapnik-dev-env bash -c 'git clone https://github.com/FreemapSlovakia/freemap-mapnik.git . && ./docker/prepare_osm.sh && ./docker/prepare_hillshading.sh && ./docker/prepare_contours.sh'

# apply additional SQL scripts

docker run --rm --name=freemap-mapnik -v $(pwd):/freemap-mapnik --network=freemap-bridge -p 4000:4000 -w /freemap-mapnik -it zdila/freemap-mapnik-dev-env bash -c 'apt-get update && apt-get -y install --no-install-recommends postgresql-client && cat additional.sql | PGPASSWORD=secret psql -h freemap-postgis postgres postgres'

Running mapserver

From project home directory (freemap-mapnik) run following commands:

docker run --rm --name=freemap-mapnik -v $(pwd):/freemap-mapnik --network=freemap-bridge -p 4000:4000 -w /freemap-mapnik -e NODE_ENV=docker -it zdila/freemap-mapnik-dev-env bash -c 'npm i && npm run watch'

Viewing the map

Alternatives:

  • open preview.html in your browser
  • use any app where you can enter following TMS URL template: http://localhost:4000/{z}/{x}/{y}
  • use JSOM
    • use TMS map URL tms[19]:http://localhost:4000/{zoom}/{x}/{y}
    • after changing and saving some style right-click the map and choose FLush tile cache.