Compare commits
23 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a364466d93 | ||
|
b93f524413 | ||
|
a161cae48d | ||
|
f43d913209 | ||
|
bf4e6e42ec | ||
|
24d1b5709d | ||
|
ed9a401409 | ||
|
4895e86c55 | ||
|
d8251d5dd7 | ||
|
ba14c03705 | ||
|
f3ec2c0df0 | ||
|
17edd862a7 | ||
|
a62a10552b | ||
|
b994c64d6b | ||
|
f5c2022e7f | ||
|
830155628f | ||
|
40a760e941 | ||
|
6488beaf79 | ||
|
0fca85665f | ||
|
ebe7d6b336 | ||
|
0bbebc0f4a | ||
|
c2b79805a0 | ||
|
6276d18671 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,5 +1,7 @@
|
||||
pbf/*.pbf
|
||||
pbf/*.poly
|
||||
pbf/shp/*
|
||||
pbf/*.tif
|
||||
tiles/*
|
||||
!tiles/.gitkeep
|
||||
database/*
|
||||
|
23
README.md
23
README.md
@ -20,6 +20,19 @@ For entering into the container, use the "terminal" argument of the run.sh scrip
|
||||
docker-compose run --rm map terminal
|
||||
```
|
||||
|
||||
#### OAM data dependencies
|
||||
|
||||
##### Contour lines
|
||||
|
||||
Download the geopackage from http://opendata.champs-libres.be/beautiful-contour-belgium.zip, convert it to shp and place it into the pbf/shp folder under the name "contours.shp". It will be mounted as written in the `docker-compose.yml` file.
|
||||
|
||||
The shp is imported using `shp2pgsql` in the import step, assuming EPSG:31370 as the input shp CRS.
|
||||
|
||||
#### Hillshade
|
||||
|
||||
Download the hillshade at http://opendata.champs-libres.be/hillshade_belgium_EPSG3857.zip and place the tif file in the pdf folder, as mounted in the `docker-compose.yml` file.
|
||||
|
||||
|
||||
#### Do an import
|
||||
|
||||
Download a pbf and a poly file of your choice on https://download.geofabrik.de and put it in the `pbf` folder. Change the lines of the pbf and poly paths in the volumes in the `docker-compose.yml` file
|
||||
@ -30,7 +43,7 @@ Then, you can import the OSM data by doing this command:
|
||||
docker-compose run --rm map import
|
||||
```
|
||||
|
||||
This will take a while, about 15 min for Luxembourg for example.
|
||||
This will take a while, about 15 min for Luxembourg for example, but up to 7 hours for Belgium with OAM!
|
||||
|
||||
You should end with :
|
||||
|
||||
@ -66,6 +79,14 @@ Move this `tiles.list` file in the `/tiles/` directory and then run:
|
||||
docker-compose run --rm map generate_tiles
|
||||
```
|
||||
|
||||
For Belgium up to zoom 18, it might take >48 hours!
|
||||
|
||||
#### Transfer the tiles to tiles.champs-libres.be
|
||||
|
||||
|
||||
```bash
|
||||
rsync --compress --recursive ./tiles/cyclosm debian@juniperus.champs-libres.be:/var/lib/mod_tile/
|
||||
```
|
||||
|
||||
## Original README
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<VirtualHost *:80>
|
||||
ServerAdmin webmaster@localhost
|
||||
|
||||
AddTileConfig /tile/ default
|
||||
AddTileConfig /tile/ cyclosm
|
||||
LoadTileConfigFile /etc/renderd.conf
|
||||
ModTileRenderdSocketName /run/renderd/renderd.sock
|
||||
ModTileRequestTimeout 0
|
||||
@ -9,6 +9,8 @@
|
||||
|
||||
DocumentRoot /var/www/html
|
||||
|
||||
ServerName 192.168.192.2
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
|
||||
|
@ -7,11 +7,15 @@ services:
|
||||
#- osm-data:/data/database/
|
||||
- ./database:/data/database/
|
||||
- ./tiles:/data/tiles/
|
||||
- ./oam/renderd.conf:/etc/renderd.conf
|
||||
- ./oam/alter_view_owner.sql:/data/alter_view_owner.sql
|
||||
- ./run.sh:/run.sh # for dev
|
||||
- ./pbf/luxembourg-latest.osm.pbf:/data/region.osm.pbf # change here your pbf
|
||||
- ./pbf/luxembourg.poly:/data/region.poly # and your poly
|
||||
- ./pbf/belgium-latest.osm.pbf:/data/region.osm.pbf # change here your pbf
|
||||
#- ./pbf/luxembourg.poly:/data/region.poly # and your poly -> not used
|
||||
- ./pbf/shp/:/data/shp/
|
||||
- ./pbf/hillshade.tif:/data/hillshade.tif
|
||||
ports:
|
||||
- "8080:80"
|
||||
- "9000:80"
|
||||
command: "run"
|
||||
|
||||
# volumes:
|
||||
|
20
oam/alter_view_owner.sql
Normal file
20
oam/alter_view_owner.sql
Normal file
@ -0,0 +1,20 @@
|
||||
ALTER TABLE landuse OWNER TO renderer;
|
||||
ALTER TABLE train_elements OWNER TO renderer;
|
||||
ALTER TABLE places OWNER TO renderer;
|
||||
ALTER TABLE linear_features OWNER TO renderer;
|
||||
ALTER TABLE buildings OWNER TO renderer;
|
||||
ALTER TABLE cemeteries OWNER TO renderer;
|
||||
ALTER TABLE bridge_symbols OWNER TO renderer;
|
||||
ALTER TABLE landuse_overlays OWNER TO renderer;
|
||||
ALTER TABLE waters OWNER TO renderer;
|
||||
ALTER TABLE waterways OWNER TO renderer;
|
||||
ALTER TABLE boundaries OWNER TO renderer;
|
||||
ALTER TABLE tunnels OWNER TO renderer;
|
||||
ALTER TABLE bridges OWNER TO renderer;
|
||||
ALTER TABLE roads OWNER TO renderer;
|
||||
ALTER TABLE rotated_buildings OWNER TO renderer;
|
||||
ALTER TABLE trails OWNER TO renderer;
|
||||
ALTER TABLE point_features OWNER TO renderer;
|
||||
ALTER TABLE pitch OWNER TO renderer;
|
||||
ALTER TABLE landuse_label OWNER TO renderer;
|
||||
ALTER TABLE waterway_label OWNER TO renderer;
|
21
oam/renderd.conf
Normal file
21
oam/renderd.conf
Normal file
@ -0,0 +1,21 @@
|
||||
; BASIC AND SIMPLE CONFIGURATION:
|
||||
|
||||
[renderd]
|
||||
stats_file=/run/renderd/renderd.stats
|
||||
socketname=/run/renderd/renderd.sock
|
||||
num_threads=4
|
||||
tile_dir=/var/cache/renderd/tiles
|
||||
|
||||
[mapnik]
|
||||
plugins_dir=/usr/lib/mapnik/3.1/input
|
||||
font_dir=/usr/share/fonts
|
||||
font_dir_recurse=true
|
||||
|
||||
; ADD YOUR LAYERS:
|
||||
[oam]
|
||||
URI=/tile/
|
||||
TILEDIR=/var/cache/renderd/tiles
|
||||
XML=/data/style/mapnik.xml
|
||||
HOST=localhost
|
||||
TILESIZE=256
|
||||
MAXZOOM=20
|
56
run.sh
56
run.sh
@ -12,6 +12,25 @@ function setPostgresPassword() {
|
||||
sudo -u postgres psql -c "ALTER USER renderer PASSWORD '${PGPASSWORD:-renderer}'"
|
||||
}
|
||||
|
||||
function compileStyle() {
|
||||
cd /data/style/
|
||||
git clone --single-branch --branch osm-tile-server https://github.com/nobohan/OpenArdenneMap.git --depth 1
|
||||
# mv symbols folder
|
||||
mkdir /data/img/
|
||||
mv /data/style/OpenArdenneMap/img/* /data/img/
|
||||
# copy fonts
|
||||
cp /data/style/OpenArdenneMap/fonts/* /usr/share/fonts/
|
||||
# change dbname
|
||||
sed -i 's/"dbname": "osmpg_db",/"dbname": "gis",/g' ./OpenArdenneMap/osm2pgsql/project.mml
|
||||
# change hillshade
|
||||
sed -i 's,/mnt/tera/ChampsLibres/Projets/OSM/CyclOSM/hillshade/data/dem_be_10x10_hillshade_semi_transparent_3857.tif,/data/hillshade.tif,g' ./OpenArdenneMap/osm2pgsql/project.mml
|
||||
# change contours
|
||||
sed -i 's,../contour/beautiful_contour_belgium.shp,/data/shp/contours_3857.shp,g' ./OpenArdenneMap/osm2pgsql/project.mml
|
||||
# carto build
|
||||
carto OpenArdenneMap/osm2pgsql/project.mml > mapnik.xml
|
||||
}
|
||||
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "usage: <import|run>"
|
||||
echo "commands:"
|
||||
@ -29,22 +48,14 @@ fi
|
||||
|
||||
set -x
|
||||
|
||||
# if there is no custom style mounted, then use osm-carto
|
||||
if [ ! "$(ls -A /data/style/)" ]; then
|
||||
mv /home/renderer/src/openstreetmap-carto-backup/* /data/style/
|
||||
fi
|
||||
|
||||
# carto build
|
||||
if [ ! -f /data/style/mapnik.xml ]; then
|
||||
cd /data/style/
|
||||
carto ${NAME_MML:-project.mml} > mapnik.xml
|
||||
fi
|
||||
|
||||
if [ "$1" == "terminal" ]; then
|
||||
bash
|
||||
fi
|
||||
|
||||
if [ "$1" == "import" ]; then
|
||||
|
||||
compileStyle
|
||||
|
||||
# Ensure that database directory is in right state
|
||||
mkdir -p /data/database/postgres/
|
||||
chown renderer: /data/database/
|
||||
@ -60,6 +71,7 @@ if [ "$1" == "import" ]; then
|
||||
sudo -u postgres createdb -E UTF8 -O renderer gis
|
||||
sudo -u postgres psql -d gis -c "CREATE EXTENSION postgis;"
|
||||
sudo -u postgres psql -d gis -c "CREATE EXTENSION hstore;"
|
||||
sudo -u postgres psql -d gis -c "CREATE EXTENSION postgis_sfcgal;"
|
||||
sudo -u postgres psql -d gis -c "ALTER TABLE geometry_columns OWNER TO renderer;"
|
||||
sudo -u postgres psql -d gis -c "ALTER TABLE spatial_ref_sys OWNER TO renderer;"
|
||||
setPostgresPassword
|
||||
@ -100,10 +112,7 @@ if [ "$1" == "import" ]; then
|
||||
fi
|
||||
|
||||
# Import data
|
||||
sudo -u renderer osm2pgsql -d gis --create --slim -G --hstore \
|
||||
--tag-transform-script /data/style/${NAME_LUA:-openstreetmap-carto.lua} \
|
||||
--number-processes ${THREADS:-4} \
|
||||
-S /data/style/${NAME_STYLE:-openstreetmap-carto.style} \
|
||||
sudo -u renderer osm2pgsql -d gis --create --slim -G -S /data/style/OpenArdenneMap/osm2pgsql/OpenArdenneMap.style --extra-attributes \
|
||||
/data/region.osm.pbf \
|
||||
${OSM2PGSQL_EXTRA_ARGS:-} \
|
||||
;
|
||||
@ -119,11 +128,8 @@ if [ "$1" == "import" ]; then
|
||||
sudo -u postgres psql -d gis -f /data/style/${NAME_SQL:-indexes.sql}
|
||||
fi
|
||||
|
||||
#Import external data
|
||||
chown -R renderer: /home/renderer/src/ /data/style/
|
||||
if [ -f /data/style/scripts/get-external-data.py ] && [ -f /data/style/external-data.yml ]; then
|
||||
sudo -E -u renderer python3 /data/style/scripts/get-external-data.py -c /data/style/external-data.yml -D /data/style/data
|
||||
fi
|
||||
sudo -u postgres psql -d gis -f /data/style/OpenArdenneMap/create_views.sql
|
||||
sudo -u postgres psql -d gis -f /data/alter_view_owner.sql
|
||||
|
||||
# Register that data has changed for mod_tile caching purposes
|
||||
sudo -u renderer touch /data/database/planet-import-complete
|
||||
@ -137,6 +143,8 @@ if [ "$1" == "run" ]; then
|
||||
# Clean /tmp
|
||||
rm -rf /tmp/*
|
||||
|
||||
compileStyle
|
||||
|
||||
# migrate old files
|
||||
if [ -f /data/database/PG_VERSION ] && ! [ -d /data/database/postgres/ ]; then
|
||||
mkdir /data/database/postgres/
|
||||
@ -172,7 +180,7 @@ if [ "$1" == "run" ]; then
|
||||
setPostgresPassword
|
||||
|
||||
# Configure renderd threads
|
||||
sed -i -E "s/num_threads=[0-9]+/num_threads=${THREADS:-4}/g" /etc/renderd.conf
|
||||
#sed -i -E "s/num_threads=[0-9]+/num_threads=${THREADS:-4}/g" /etc/renderd.conf
|
||||
|
||||
# start cron job to trigger consecutive updates
|
||||
if [ "${UPDATES:-}" == "enabled" ] || [ "${UPDATES:-}" == "1" ]; then
|
||||
@ -201,12 +209,16 @@ fi
|
||||
|
||||
if [ "$1" == "generate_tiles" ]; then
|
||||
|
||||
compileStyle
|
||||
|
||||
service postgresql start
|
||||
service apache2 restart
|
||||
|
||||
sudo -u renderer renderd -c /etc/renderd.conf
|
||||
|
||||
cat /data/tiles/default/tiles.list | render_list --map default
|
||||
cat /data/tiles/oam/tiles.list | render_list --map oam
|
||||
|
||||
bash
|
||||
fi
|
||||
|
||||
echo "invalid command"
|
||||
|
@ -16,8 +16,16 @@ max_y = 50.184
|
||||
min_x = 5.735
|
||||
min_y = 49.452
|
||||
|
||||
# BE ardenne coordinates
|
||||
|
||||
max_x = 6.40
|
||||
max_y = 50.77
|
||||
min_x = 4.13
|
||||
min_y = 49.49
|
||||
|
||||
|
||||
min_z = 9
|
||||
max_z = 17
|
||||
max_z = 18
|
||||
|
||||
for z in range(min_z, max_z+1):
|
||||
x1_tile, y1_tile = deg2num(max_y, max_x, z)
|
||||
|
Loading…
Reference in New Issue
Block a user