I successfully run an instance of open route service on docker (using a Frrance osm pbf file) for a few months, and I would want to modify it to add a few neighbouring countries or provinces.
Everything I find in the documentation and github only points to a single osm file designed with the environment variable OSM_FILE.
I was not able to pinpoint where and when in the code the graphs are generated so I can’t infer if I can modify anything to have OSM_FILE (or another variable) point to a list or a whole directory of osm files.
Could you please provide some advice ? Thanks in advance.
Hey,
the openrouteservice is not able to process multiple osm-files at once. Please use any other OSM tooling (osmium, osmosis, …) to merge all your .pbf-files into one, and use this to run the openrouteservice.
Best regards
1 Like
Thank you very much for your answer, osmosis it is then 
1 Like
For reference here is the part of my docker-entrypoint shell file to download & merge pbfs
if [ "$BUILD_GRAPHS" = "True" ] || [ ! -f "/ors-core/data/osm_file.pbf" ]; then
echo "Downloading and processing pbf files"
rm -f "/ors-core/data/osm_file.pbf"
rm -rf ${graphs}*
for osm_file in "${osm_list[@]}"
do
filename="${osm_file_path}${osm_file}"
echo "Processing ${osm_file}"
echo "Downloading from ${osm_gfb}${osm_file}-latest.osm.pbf..." >> ${log_path}${osm_file}.log 2>&1
while true; do
wget --output-document="${filename}.osm.pbf" "${osm_gfb}${osm_file}-latest.osm.pbf" >> ${log_path}${osm_file}.log 2>&1
computed_md5=$(md5sum "${filename}.osm.pbf" | awk '{ print $1 }')
wget --output-document="${filename}.osm.pbf.md5" "${osm_gfb}${osm_file}-latest.osm.pbf.md5" >> ${log_path}${osm_file}.log 2>&1
expected_md5=$(cat "${filename}.osm.pbf.md5" | awk '{ print $1 }')
if [[ "$computed_md5" == "$expected_md5" ]]; then
echo "File successfully downloaded and verified." >> ${log_path}${osm_file}.log 2>&1
rm "${filename}.osm.pbf.md5"
break
else
echo "MD5 checksum mismatch. Redownloading the file..." >> ${log_path}${osm_file}.log 2>&1
rm "${filename}.osm.pbf.md5" "${filename}.osm.pbf"
fi
done
if [ $? -ne 0 ]; then
echo "Error: Failed to download the file." >> ${log_path}${osm_file}.log 2>&1
exit 1
fi
if [ ! -f "/ors-core/data/osm_file.pbf" ]; then
echo "sorting file" >> ${log_path}${osm_file}.log 2>&1
osmium sort --strategy="multipass" -v -o "${filename}-sorted.osm.pbf" "${filename}.osm.pbf" >> ${log_path}${osm_file}.log 2>&1
echo "creating file /ors-core/data/osm_file.pbf" >> ${log_path}${osm_file}.log 2>&1
mv "${filename}-sorted.osm.pbf" "/ors-core/data/osm_file.pbf"
else
echo "sorting file" >> ${log_path}${osm_file}.log 2>&1
osmium sort --strategy="multipass" -v -o "${filename}-sorted.osm.pbf" "${filename}.osm.pbf" >> ${log_path}${osm_file}.log 2>&1
echo "merging file on /ors-core/data/osm_file.pbf" >> ${log_path}${osm_file}.log 2>&1
osmium merge -v "/ors-core/data/osm_file.pbf" "${filename}-sorted.osm.pbf" -o "/ors-core/data/osm_tmp.pbf" >> ${log_path}${osm_file}.log 2>&1
mv "/ors-core/data/osm_tmp.pbf" "/ors-core/data/osm_file.pbf"
rm -f "${filename}-sorted.osm.pbf"
fi
done
fi
1 Like