gis-ops / pyvalhalla

High-level Python bindings to the Valhalla routing framework.
GNU General Public License v2.0
58 stars 4 forks source link

Question: Graphs for multiple countries #38

Closed thomthom closed 1 month ago

thomthom commented 1 month ago

Apologies if this isn't the place to ask questions. I'll happily repost in a forum or discord if there is one.

I'm completely new to OSM and Valhalla. I just got a simple POC setup using the instructions in the readme here, fetching graph data for a country:

docker run --rm --name valhalla_gis-ops -p 8002:8002 -v $PWD/custom_files:/custom_files -e tile_urls=https://download.geofabrik.de/europe/andorra-latest.osm.pbf gisops/valhalla:latest

However, it's not clear to me what one would have to do to obtain data for multiple countries and use them for routing across them.

config = get_config(tile_extract='./custom_files/valhalla_tiles.tar', verbose=True)

This line where the config it setup, seems to take a single tar from from what the docker command fetched? Would I somehow need to merge multiple tile data into one tar file?

chrstnbwnkl commented 1 month ago

Valhalla is supposed to handle multiple PBF files, but as noted here there are some issues with that, so the best thing you can do is use something like osmium-tool to merge the PBFs you want to build a graph from and supply that to the docker container. Combining two or more graphs (whether .tar files or file trees) after building them does not work.

thomthom commented 1 month ago

I see. From that thread I sounds like grabbing a larger data set, like Europe and extract what I want.

And I need to pass that to the docker container because it contains tools that will process and generate the graphs needed? That isn't something that is part of Valhalla itself?

Is tile_urls still the param I can use, given that I'll then have the pbf data locally?

thomthom commented 1 month ago

Never mind, I saw the README for the docker project: https://github.com/gis-ops/docker-valhalla

# download a file to custom_files and start valhalla
mkdir custom_files
wget -O custom_files/andorra-latest.osm.pbf https://download.geofabrik.de/europe/andorra-latest.osm.pbf
docker run -dt --name valhalla_gis-ops -p 8002:8002 -v $PWD/custom_files:/custom_files ghcr.io/gis-ops/docker-valhalla/valhalla:latest
# or let the container download the file for you
docker run -dt --name valhalla_gis-ops -p 8002:8002 -v $PWD/custom_files:/custom_files -e tile_urls=https://download.geofabrik.de/europe/andorra-latest.osm.pbf ghcr.io/gis-ops/docker-valhalla/valhalla:latest

I was hopping between valhalla, pyvalhalla and the docker repo and getting lost.

Thank you for your response.

chrstnbwnkl commented 1 month ago

Yes correct, graph building from the bindings is currently not supported (but we're always welcoming contributions)