Overv / openstreetmap-tile-server

Docker file for a minimal effort OpenStreetMap tile server
Apache License 2.0
1.23k stars 485 forks source link

How to prerender tiles in 2022 #343

Closed CoWayger closed 1 year ago

CoWayger commented 1 year ago

Hello, I have imported Europe and found many old ways to prerender tiles, but none of them currently works in actual image. I came up with following command which should do the work, but it is stuck forever and no CPU is used. Please can you update readme and tell folks how to prerender tiles in current image? Thank you.

My almost working command:

for level 2-3, 1 thread

sudo -u _renderd render_list -t /data/tiles -m ajt -a -z 2 -Z 3 -n 1

Output: root@6a2f04dd02b1:/# sudo -u _renderd render_list -m ajt -a -z 2 -Z 3 -n 1 Rendering client Starting 1 rendering threads Rendering all tiles from zoom 2 to zoom 3 Rendering all tiles for zoom 2 from (0, 0) to (3, 3) Rendering all tiles for zoom 3 from (0, 0) to (7, 7) Waiting for rendering threads to finish

few hours later still nothing. CPU usage 4%, no activity from container

CoWayger commented 1 year ago

In case anyone wants to prerender specific area in 2022:

enter docker container

c=$(docker ps | grep "overv/openstreetmap-tile-server" | grep -Eo "^[0-9a-f]+") docker exec -it "$c" bash

download script for prerendering & set exec bit

wget https://raw.githubusercontent.com/alx77/render_list_geo.pl/master/render_list_geo.pl chmod +x render_list_geo.pl

get coord list on https://tools.geofabrik.de/calc/#type=geofabrik_standard&bbox=11.910132,48.503826,19.08445,51.182128&tab=1&proj=EPSG:4326&places=2

./render_list_geo.pl -x 11.91 -X 19.09 -y 48.5 -Y 51.19 -z 13 -Z 17 -n 4

It would be nice if some maintainer mentioned this procedure as docker image without prerendering is pretty non-production ready. :)

Istador commented 1 year ago

you need to specify output dir, otherwise output will be in renderd cache location, which is lost on container reboot

Is this really necessary? /var/cache/renderd/tiles should be a symlink pointing to /data/tiles and as long as that one is mounted as a volume, it should carry over to new containers.

Or does it save the tiles somewhere else than /var/cache/renderd/tiles?

Also afaik the -t parameter is only to tell render_list where to check if tiles exist already. The actual generation and storing of the files is handled by renderd independant of this parameter. A wrong or missing parameter should just cause it to re-render the tiles, even when the tiles already exist.

CoWayger commented 1 year ago

@Istador Yup, sorry I missed the symlink. Edited the post.