Skip to content

Commit e8fdd0b

Browse files
committed
Merge branch 'master' into feature/implement-OpenTopoMap
2 parents b5a568f + 8d48836 commit e8fdd0b

5 files changed

+208
-1
lines changed

datasource-settings.sed

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Perform sed substitutions for `datasource-settings.xml.inc`
22
s/%(dbname)s/gis/
3-
s/%(host)s/postgis/
3+
s/%(host)s/localhost/
44
s/%(estimate_extent)s/false/
55
s/%(extent)s/-20037508,-19929239,20037508,19929239/
66
s/<Parameter name="\([^"]*\)">%(\([^)]*\))s<\/Parameter>/<!-- <Parameter name="\1">%(\2)s<\/Parameter> -->/

docker-compose.yml

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
postgis:
2+
#image: osm-tiles-server:2.0
3+
#image: bbouffaut/osm-tiles-server:2.0
4+
#image: ncareol/osm-tiles
5+
image: registry.bbofamily.com/osm-tiles-server:2.1
6+
hostname: postgis
7+
volumes:
8+
# keep postgresql database files on host in ./docker/osm:
9+
- /srv/z1-db_data/osm-tiles-server_postgre:/var/lib/postgresql
10+
# mount OSM data file from host into Docker container
11+
- /srv/z1-db_data/osm-tiles-server_data/europe-latest.osm.pbf:/tmp/europe-latest.osm.pbf
12+
# mount OSM data file from host into Docker container
13+
- /srv/z1-db_data/osm-tiles-server_data/srtm_list.txt:/tmp/srtm_list.txt
14+
# keep OSM tiles on host in ./docker/osm:
15+
- /srv/z1-db_data/osm-tiles-server_data:/data
16+
environment:
17+
OSM_IMPORT_FILE: '/tmp/europe-latest.osm.pbf'
18+
SRTM_LIST_FILE: '/tmp/srtm_list.txt'
19+
OSM_IMPORT_CACHE: '2000'
20+
OSM_MAX_ZOOM: '14'
21+
OSM_RENDER_FORCE: 'false'
22+
expose:
23+
- 5432
24+
ports:
25+
- "5432:5432"
26+
command: 'startservices_postgis'
27+
28+
29+
opentopomap:
30+
#image: osm-tiles-server:2.0
31+
#image: bbouffaut/osm-tiles-server:2.0
32+
#image: ncareol/osm-tiles
33+
image: registry.bbofamily.com/osm-tiles-server:2.1
34+
hostname: opentopomap
35+
links:
36+
- postgis
37+
volumes:
38+
# keep OSM tiles on host in ./docker/osm:
39+
- /srv/z1-db_data/osm-tiles-server_mod_tile:/var/lib/mod_tile
40+
environment:
41+
OSM_MAX_ZOOM: '14'
42+
OSM_RENDER_FORCE: 'false'
43+
ports:
44+
- "8383:80"
45+
extra_hosts:
46+
- "postgis:172.17.0.7"
47+
command: 'startservices_render_opentopomap'
48+
49+
osm:
50+
#image: osm-tiles-server:2.0
51+
#image: bbouffaut/osm-tiles-server:2.0
52+
#image: ncareol/osm-tiles
53+
image: registry.bbofamily.com/osm-tiles-server:2.1
54+
hostname: osm
55+
links:
56+
- postgis
57+
volumes:
58+
# keep OSM tiles on host in ./docker/osm:
59+
- /srv/z1-db_data/osm-tiles-server_mod_tile:/var/lib/mod_tile
60+
environment:
61+
OSM_MAX_ZOOM: '14'
62+
OSM_RENDER_FORCE: 'false'
63+
ports:
64+
- "8282:80"
65+
command: 'startservices_render_osm'
66+
67+
all:
68+
#image: osm-tiles-server:2.0
69+
#image: bbouffaut/osm-tiles-server:2.0
70+
#image: ncareol/osm-tiles
71+
image: registry.bbofamily.com/osm-tiles-server:2.1
72+
hostname: postgis
73+
volumes:
74+
# keep postgresql database files on host in ./docker/osm:
75+
- /srv/z1-db_data/osm-tiles-server_postgre:/var/lib/postgresql
76+
# mount OSM data file from host into Docker container
77+
- /srv/z1-db_data/osm-tiles-server_data/europe-latest.osm.pbf:/tmp/europe-latest.osm.pbf
78+
# mount OSM data file from host into Docker container
79+
- /srv/z1-db_data/osm-tiles-server_data/srtm_list.txt:/tmp/srtm_list.txt
80+
# keep OSM tiles on host in ./docker/osm:
81+
- /srv/z1-db_data/osm-tiles-server_data:/data
82+
# keep OSM tiles on host in ./docker/osm:
83+
- /srv/z1-db_data/osm-tiles-server_mod_tile:/var/lib/mod_tile
84+
environment:
85+
OSM_IMPORT_FILE: '/tmp/europe-latest.osm.pbf'
86+
SRTM_LIST_FILE: '/tmp/srtm_list.txt'
87+
OSM_IMPORT_CACHE: '2000'
88+
OSM_MAX_ZOOM: '14'
89+
OSM_RENDER_FORCE: 'false'
90+
expose:
91+
- 5432
92+
- 80
93+
ports:
94+
- "5432:5432"
95+
- "8383:80"
96+
command: 'startservices_postgis'

run.sh

+5
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,11 @@ startservices_render_opentopomap () {
355355
_startservice apache2
356356
}
357357

358+
startservices_postgis_and_render_opentopomap () {
359+
startservices_postgis
360+
startservices_render_opentopomap
361+
}
362+
358363
render_opentopomap () {
359364
configure_renderd_for_opentopomap
360365
render

script-contours.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
LOG="../../import-contours.log"
3+
cd out/out_contours
4+
for X in *.shp.gz; do
5+
#~ X="contours_47-6.shp.gz"
6+
gunzip $X
7+
ogr2ogr -explodecollections -a_srs epsg:3857 -append -f "PostgreSQL" 'PG:dbname='contours2'' -nln contours -lco DIM=2 ${X%.*}
8+
gzip ${X%.*}
9+
echo $(date)' '$X' done'>> $LOG
10+
done
11+
echo $(date) 'analyse'>> $LOG
12+
echo "VACUUM ANALYSE;" | psql -d contours2
13+
echo $(date)' '$X' done'>> $LOG
14+
echo 'DONE'>> $LOG
15+
16+
17+
exit 0

script-contours_parallel.sh

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/bin/bash
2+
LOG="../../import-contours.log"
3+
cd out/out_contours
4+
5+
import()
6+
{
7+
X=$1
8+
gunzip $X
9+
ogr2ogr -explodecollections -a_srs epsg:3857 -append -f "PostgreSQL" 'PG:dbname='contours2'' -nln contours -lco DIM=2 ${X%.*}
10+
gzip ${X%.*}
11+
echo $(date)' '$X' done'>> $LOG
12+
#~ echo $X
13+
#~ sleep 2
14+
}
15+
#~ X="contours_47-6.shp.gz"
16+
for X in *.shp.gz;
17+
do
18+
count=`jobs -p | wc -l`
19+
echo $count
20+
while [ `jobs -p | wc -l` -ge 3 ]
21+
do
22+
sleep 5
23+
done
24+
import $X &
25+
done
26+
27+
echo $(date) 'analyse'>> $LOG
28+
echo "VACUUM ANALYSE;" | psql -d contours2
29+
echo $(date)' '$X' done'>> $LOG
30+
echo 'DONE'>> $LOG
31+
32+
33+
exit 0
34+
#~
35+
createdb -U mapnik contours2
36+
psql -d contours2 -U mapnik -f /usr/share/postgresql/9.1/contrib/postgis-2.0/postgis.sql
37+
psql -d contours2 -U mapnik -f /usr/share/postgresql/9.1/contrib/postgis-2.0/spatial_ref_sys.sql
38+
39+
Note: projection not recognized: wkb_geometry | geometry(MultiLineString,900914) |
40+
SELECT UpdateGeometrySRID('contours','wkb_geometry',3857);
41+
ogr2ogr -a_srs epsg:3857 -append -f "PostgreSQL" 'PG:dbname='contours2'' -nln contours -nlt MULTILINESTRING -lco DIM=2 ${X%.*}
42+
43+
#~ #echo "ALTER USER mapnik WITH PASSWORD 'mapnik';" | psql -d contour # not usefull
44+
#~ exit
45+
#~ dropdb contours
46+
#~
47+
#~ # test:
48+
#~ 457 GB
49+
#~ select count(*) from contours where ST_intersects(way, ST_MakeEnvelope(-180,72,180,85));
50+
#~ echo "select count(*) from contours where ST_intersects(way, ST_MakeEnvelope(-180,72,180,85));" | psql -d contours
51+
#~
52+
#~ 963GB
53+
#~ echo "vacuum;" | psql -d contours
54+
#~ # size of the db:
55+
#~ cd /var/lib/postgresql/8.4/main/base
56+
#~ du -sh *
57+
#~
58+
#~ shared_buffers = 256MB
59+
#~ time shp2pgsql -a -g way N06E124 contours | psql -U mapnik -q contour
60+
#~ real 6m45.981s
61+
#~ user 1m0.400s
62+
#~ sys 0m15.977s
63+
#~
64+
#~ shared_buffers = 4100MB
65+
#~ sudo /etc/init.d/postgresql-8.4 restart
66+
#~ # get the shmmax value from message
67+
#~ sudo sysctl -w kernel.shmmax=4403486720 #(temporary)
68+
#~ sudo nano /etc/sysctl.conf
69+
#~ kernel.shmmax=4403486720 #(permanent)
70+
#~ sudo /etc/init.d/postgresql-8.4 restart
71+
#~ time shp2pgsql -a -g way N06E124 contours | psql -U mapnik -q contour
72+
#~ real 6m45.998s
73+
#~ user 1m0.092s
74+
#~ sys 0m16.669s
75+
#~ => disk is the limiting factor?
76+
77+
78+
#~ echo "ALTER TABLE contour ADD COLUMN contour3857 geometry(LINESTRING,3857);" | psql -d contours #(long 5h ??)
79+
#~ echo "ALTER TABLE contour drop column contour3857;" | psql -d contours
80+
#~ echo $(date) ": table dropped"
81+
#~ echo "SELECT AddGeometryColumn ('contour','contour3857',3857,'LINESTRING',2, false);" | psql -d contours
82+
#~ echo $(date) ": AddGeometryColumn done"
83+
#~ echo "UPDATE contour SET contour3857=ST_Transform(wkb_geometry,3857);" | psql -d contours
84+
#~ echo $(date) ": table updated"
85+
echo "SELECT DropGeometryColumn ('contour','wkb_geometry');" | psql -d contours
86+
echo $(date) ": DropGeometryColumn done"
87+
#~ echo "CREATE INDEX contour3857_geom_idx ON contour USING gist (contour3857);" | psql -d contours pas nécessaire !
88+
#~ echo date ": Index done"
89+
echo "CREATE INDEX contours_idx ON contours USING gist (contours);" | psql -d contours2

0 commit comments

Comments
 (0)