Soaring oriented tile server, based on osmhike.
Goals:
- only show information relevant for soaring pilots (land type, contours, hillshade, peaks, main cities, cables)
- reproducible way to generate the tiles
Designed for Linux. The Docker infrastructure must be installed ( see mini-guide in tutorial ) Optimized for 8GB memory. If you have only 4GB, modify dbconf/myconf.conf
People stuck on Windows, might try the WSL feature of Windows, which allows to run Linux inside Windows... It has been tested on a 8GB memory Windows10 PC, allowing 4GB for WSL.
Notes:
- this installation contains OSM data for Andorra, to have a small working example
Go to project directory ( where file docker-compose-yml resides )
Build the Docker images
docker compose build
Launch database in the background:
docker compose up -V -d db
Import the data:
Note that after this command, the db container will exit from its terminal. But it continues to work in background. Also note that it can take a long time for large areas (about 24 hours for Europe).
docker compose up -V import
Generate peak isolations data and city isolations data (note the usage of RUN command with argument)
The download of elevation data from Internet may take many minutes.
docker compose run --rm import isolations
docker compose run --rm import city_isolations
Generate contours lines ( note the usage of RUN command with argument )
docker compose run --rm import contours
Note: The download speed from viewfinderpanoramas may be incredibly slow at some moments. It seems it works better when Americans are spleeping...
Generate hillshade (note the usage of RUN command with argument)
docker compose run --rm import hillshade
Launch the tiles web server. Note: the first time, it may spend many minutes to download shapefiles from Internet...
docker compose up -V kosmtik
Navigate in the map: open a browser on the below url, and move the map until you see Andorra
http://localhost:8888
To stop the tile server, just type CTRL/C in its window
To stop the database, use: docker compose stop db
Note: You can ommit "docker compose up db" It will be done silently when launching import or kosmtik ( but the first execution of "db" initializes the database, and I prefer to see clearly what happens at that moment )
Note: The -V option inside docker-compose up -V, forces the container to start from a fresh new filesystem It is useful when you stop/start the container several times
Note: After many runs, the Docker system may be overloaded with obsolete stuff (stopped containers ...) This commands does some cleaning
docker system prune
Remove any previous export
rm -rf ./files/export
Export the whole world:
docker compose run --rm kosmtik export-tiles --minZoom 0 --maxZoom 10 --bounds=-180,-85,180,85
If using a higher-resolution area (e.g. WRF domain):
docker compose run --rm kosmtik export-tiles --minZoom 11 --maxZoom 14 \
--bounds=$(cat files/myfiles/wrf-domain.bbox)
Tiles are in directory ./files/export.
In file ".env" , modify the variables which define the files to use ( filenames are relative to subdirectory "files/myfiles" )
- AREAOSM : the name of the .osm.pbf file
- AREAPOLY: the name of the polygon file that define the area for which the import phase will download "elevation data"
- HIGHRESAREABBOX: the name of a
.bboxfile defining the high-resolution area (zoom 11+). A.bboxfile is a plain text file containing a single line:minlon,minlat,maxlon,maxlat. Contours are clipped to this bounding box (+ 0.5° buffer) to keep the DB small. The tile-export--boundsis read directly from this file withcat.
The best place to find such data is
Then run again import phases ( Caution! it will erase previous database )
docker compose up -V import && \
docker compose run --rm import isolations && \
docker compose run --rm import city_isolations && \
docker compose run --rm import contours && \
docker compose run --rm import hillshade
CAUTION ! "1 arc second" resolution is not available for all countries ( check https://viewfinderpanoramas.org/Coverage%20map%20viewfinderpanoramas_org1.htm ) In this case, you must modify a parameter in ".env" to switch to "3 seconds arc" resolution
AREAPOLYSOURCE=view3
Execute psql to navigate into database
docker compose run import psql
Or, uncomment the port mapping in docker-compose.yml for the db container and restart it. Then, use your local client (e.g. pgadmin) to connect to database server, with the following parameters:
- host: localhost
- port: 5432
- database: osm
- user: postgres
- password: postgres