diff --git a/Makefile b/Makefile index c76abfa..f66df46 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ PROJECT_ID := dockerosm -# COMPOSE_FILE := docker-compose-web.yml COMPOSE_FILE := docker-compose.yml +# Uncomment the next line if you want to display data with Leaflet. +# COMPOSE_FILE := docker-compose-web.yml .PHONY: logs @@ -8,6 +9,13 @@ COMPOSE_FILE := docker-compose.yml # DOCKER MANAGEMENT ### +status: + @echo + @echo "------------------------------------------------------------------" + @echo "Status in production mode" + @echo "------------------------------------------------------------------" + @docker-compose -f $(COMPOSE_FILE) -p $(PROJECT_ID) ps + build: @echo diff --git a/docker-compose-web.yml b/docker-compose-web.yml index 3d8c4a9..eb1f0a0 100644 --- a/docker-compose-web.yml +++ b/docker-compose-web.yml @@ -93,14 +93,14 @@ osmupdate: - TIME=120 qgisserver: - image: kartoza/qgis-server:2.14 + image: kartoza/qgis-server:2.18 hostname: dockerosm_qgisserver container_name: dockerosm_qgisserver #volumes_from: # - btsync volumes: - ./logs:/var/log/apache2 - - ./web:/web + - ./web:/project - ./settings:/web/settings links: - db:db diff --git a/docker-imposm3/importer.py b/docker-imposm3/importer.py index 902f2bd..ab9c384 100644 --- a/docker-imposm3/importer.py +++ b/docker-imposm3/importer.py @@ -19,14 +19,13 @@ ***************************************************************************/ """ -from sys import exit +from sys import exit, stderr from os import environ, listdir from shutil import move from os.path import join, exists, abspath, isabs from psycopg2 import connect, OperationalError from subprocess import call from time import sleep -from sys import stderr class Importer(object): @@ -64,7 +63,7 @@ class Importer(object): @staticmethod def info(message): - print message + print(message) @staticmethod def error(message): diff --git a/docker-osmupdate/download.py b/docker-osmupdate/download.py index 2e4c0ca..b77a8fa 100644 --- a/docker-osmupdate/download.py +++ b/docker-osmupdate/download.py @@ -21,11 +21,10 @@ from os.path import exists, join, isabs, abspath from os import listdir, environ -from sys import exit +from sys import exit, stderr from subprocess import call, Popen, PIPE from datetime import datetime from time import sleep -from sys import stderr class Downloader(object): @@ -47,7 +46,7 @@ class Downloader(object): @staticmethod def info(message): - print message + print(message) @staticmethod def error(message): diff --git a/readme.md b/readme.md index 9008ff3..3529e94 100644 --- a/readme.md +++ b/readme.md @@ -80,6 +80,19 @@ You can check the timestamp of your database by reading the file : or you can use : 'make timestamp' +### Display + +In the makefile, you can switch to another docker compose project. +The other one includes QGIS Server. When it's running, you should be able to +open, on the host(not in docker), the `index.html` file and see OSM and QGIS +Server showing PostGIS tables. The webpage is using Leaflet. + +If you want to tweak the QGIS Project, you need to add a host in your in `/etc/hosts`: +``` +127.0.0.1 db +``` +Because in the docker-compose file, the link is made with the PostGIS database using the alias `db`. + ## In the background ![architecture](https://raw.githubusercontent.com/kartoza/docker-osm/develop/docs/docker-compose.png) diff --git a/web/index.html b/web/index.html index 66e7442..45024e1 100644 --- a/web/index.html +++ b/web/index.html @@ -35,16 +35,15 @@ xmlhttp.onreadystatechange=function() { timestamp = xmlhttp.responseText; } } -xmlhttp.open("GET", "/settings/timestamp.txt", false ); +xmlhttp.open("GET", "settings/timestamp.txt", false ); xmlhttp.send(); document.getElementById('overlay').innerHTML = timestamp; var map = L.map('map').setView([0, 0], 3); var osm = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png?').addTo(map); -var wms = L.tileLayer.wms("http://localhost:8198/cgi-bin/qgis_mapserv.fcgi?", { - map: '/web/project.qgs', - layers: 'project', +var wms = L.tileLayer.wms("http://localhost:8198/", { + layers: 'osm_buildings20160720014515980', format: 'image/png', transparent: true, attribution: "OpenStreetMap" diff --git a/web/project.qgs b/web/project.qgs index 563a78d..76ff7ec 100644 --- a/web/project.qgs +++ b/web/project.qgs @@ -1,24 +1,14 @@ - + + + - + - - - - - - - - - - - - - + @@ -26,10 +16,10 @@ degrees - 106.81084573181763631 - -6.18535342286558354 - 106.84230487920439145 - -6.16519388760140963 + 47.52122050961614264 + -18.91370031309673294 + 47.52770232007358686 + -18.90150075927243023 0 1 @@ -51,50 +41,30 @@ + + + + - osm_admin20160720014515864 osm_buildings20160720014515980 - osm_roads20160720085546181 - osm_places20160720085546207 - osm_waterareas20160720085546222 - osm_waterways20160720085546269 + osm_roads20180302190105366 - - - - - - - - - - - - @@ -104,278 +74,7 @@ - - osm_admin20160720014515864 - dbname='gis' host=db port=5432 user='docker' password='docker' sslmode=disable key='id' srid=4326 type=MultiPolygon table="public"."osm_admin" (geometry) sql= - - - - osm_admin - - - +proj=longlat +datum=WGS84 +no_defs - 3452 - 4326 - EPSG:4326 - WGS 84 - longlat - WGS84 - true - - - postgres - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 0 - 0 - name - - - - - - - - - - - . - - - - . - - 0 - . - - 0 - generatedlayout - - - - - - - + osm_buildings20160720014515980 dbname='gis' host=db port=5432 user='docker' password='docker' sslmode=disable key='id' srid=4326 type=MultiPolygon table="public"."osm_buildings" (geometry) sql= @@ -395,7 +94,6 @@ def my_form_open(dialog, layer, feature): postgres - @@ -404,16 +102,16 @@ def my_form_open(dialog, layer, feature): - + - + - + - + @@ -439,6 +137,7 @@ def my_form_open(dialog, layer, feature): + @@ -565,18 +264,20 @@ def my_form_open(dialog, layer, feature): + + - - + + 0 0 @@ -603,17 +304,54 @@ def my_form_open(dialog, layer, feature): - - + + + + + + + + + + + + + + + + + + + + + + + + - + . + + + + + + - + + + + + . 0 @@ -642,444 +380,16 @@ def my_form_open(dialog, layer, feature): - - - osm_places20160720085546207 - dbname='gis' host=db port=5432 user='docker' password='docker' sslmode=disable key='id' srid=4326 type=Point table="public"."osm_places" (geometry) sql= - - - - osm_places - - - +proj=longlat +datum=WGS84 +no_defs - 3452 - 4326 - EPSG:4326 - WGS 84 - longlat - WGS84 - true - - - postgres + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 0 - 0 - name - - - - - - - - - - - . - - - - . - - 0 - . - - 0 - generatedlayout - - - - - - - osm_roads20160720085546181 + + osm_roads20180302190105366 dbname='gis' host=db port=5432 user='docker' password='docker' sslmode=disable key='id' srid=4326 type=LineString table="public"."osm_roads" (geometry) sql= @@ -1097,8 +407,7 @@ def my_form_open(dialog, layer, feature): true - postgres - + postgres @@ -1107,40 +416,40 @@ def my_form_open(dialog, layer, feature): - + - + - + - + - + - + - + - + - + - + - + - + @@ -1334,37 +643,76 @@ def my_form_open(dialog, layer, feature): - - + + + + + + + + + + + + + + + + + + + + + + + + - + . + + + + + + + + + + + + + + - + + + + . 0 . - 0 generatedlayout @@ -1373,853 +721,115 @@ def my_form_open(dialog, layer, feature): - - - osm_waterareas20160720085546222 - dbname='gis' host=db port=5432 user='docker' password='docker' sslmode=disable key='id' srid=4326 type=MultiPolygon table="public"."osm_waterareas" (geometry) sql= - - - - osm_waterareas - - - +proj=longlat +datum=WGS84 +no_defs - 3452 - 4326 - EPSG:4326 - WGS 84 - longlat - WGS84 - true - - - postgres + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 0 - 0 - name - - - - - - - - - - - . - - - - . - - 0 - . - - 0 - generatedlayout - - - - - - - - osm_waterways20160720085546269 - dbname='gis' host=db port=5432 user='docker' password='docker' sslmode=disable key='id' srid=4326 type=LineString table="public"."osm_waterways" (geometry) sql= - - - - osm_waterways - - - +proj=longlat +datum=WGS84 +no_defs - 3452 - 4326 - EPSG:4326 - WGS 84 - longlat - WGS84 - true - - - postgres - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - 0 - 0 - name - - - - - - - - - - - . - - - - . - - 0 - . - - 0 - generatedlayout - - - - - - - - - - - - true - - - - - - - false - - - + + + +proj=longlat +datum=WGS84 +no_defs + EPSG:4326 + 3452 + 1 + + + meters + m2 + + + false + + + + + + true + 255 + + + None + false + 90 - - - 2 - true - MU - - - false + - - - false - - WGS84 - - 17 + + + conditions unknown + + + + false + + + 1 + + EPSG:4326 + EPSG:3857 + + + 2 + + osm_buildings20160720014515980 + + + disabled + + current_layer + + + 1 + + + to_vertex_and_segment + + off + 0 + + 0.000000 + + + + + + + + + + + + + + + + false + + + + 2 + true + MU + 0 106 @@ -2229,50 +839,14 @@ def my_form_open(dialog, layer, feature): 255 219 - - 2 - - - current_layer - - - - off - 0 - - - - - - - - - None - - - false - - - +proj=longlat +datum=WGS84 +no_defs - EPSG:4326 - 3452 - 1 - - - - - - true - 255 - - - conditions unknown - 90 - - meters - m2 - - + + WGS84 + + + + + true + true