Skip to content

Commit

Permalink
feat(valhalla): increasse isochrone limits in valhalla config
Browse files Browse the repository at this point in the history
  • Loading branch information
azarz committed Mar 18, 2024
1 parent 008a5e3 commit 8950fe6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## x.y.z

## 2.2.5

CHANGED:
- Valhalla build config: increase default isochrone limits

## 2.2.4

CHANGED:
Expand Down
12 changes: 8 additions & 4 deletions r2gg/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,16 +407,20 @@ def valhalla_convert(config, resource, logger, build_lua_from_cost_config = True
start_command = time.time()
valhalla_build_config_args = ["valhalla_build_config",
"--mjolnir-tile-dir", source["storage"]["dir"],
"--mjolnir-tile-extract", source["storage"]["tar"]]
"--mjolnir-tile-extract", source["storage"]["tar"],
# Modification des limites par défaut du service : 10h pour isochrone et 1000km pour iso distance
# contre 2h et 200km par défaut
"--service-limits-isochrone-max-time-contour", "600",
"--service-limits-isochrone-max-distance-contour", "1000",
# Ajout de l'autorisation à exclure les ponts/tunnels/péages
"--service-limits-allow-hard-exclusions", "True"]
subprocess_execution(valhalla_build_config_args, logger, outfile = source["storage"]["config"])
# Nécessaire le temps que le fichier s'écrive...
time.sleep(1)
# Ajout du graph custom dans la config valhalla
# Ajout du graph custom dans la config valhalla (impossible via les paramètres du build_config)
with open(source["storage"]["config"], "r") as valhalla_config:
config_dict = json.load(valhalla_config)
config_dict["mjolnir"]["graph_lua_name"] = source["costs"][0]["compute"]["storage"]["file"]
# Ajout de l'autorisation à exclure les ponts/tunnels/péages
config_dict["service_limits"]["allow_hard_exclusions"] = True

with open(source["storage"]["config"], "w") as valhalla_config:
valhalla_config.write(json.dumps(config_dict))
Expand Down

0 comments on commit 8950fe6

Please sign in to comment.