r2gg 2.2.3__py3-none-any.whl → 2.2.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- r2gg/__about__.py +1 -1
- r2gg/_main.py +8 -4
- r2gg/_pivot_to_pgr.py +32 -2
- r2gg/_subprocess_execution.py +8 -1
- {r2gg-2.2.3.dist-info → r2gg-2.2.5.dist-info}/METADATA +1 -1
- {r2gg-2.2.3.dist-info → r2gg-2.2.5.dist-info}/RECORD +10 -10
- {r2gg-2.2.3.dist-info → r2gg-2.2.5.dist-info}/WHEEL +1 -1
- {r2gg-2.2.3.dist-info → r2gg-2.2.5.dist-info}/LICENSE +0 -0
- {r2gg-2.2.3.dist-info → r2gg-2.2.5.dist-info}/entry_points.txt +0 -0
- {r2gg-2.2.3.dist-info → r2gg-2.2.5.dist-info}/top_level.txt +0 -0
r2gg/__about__.py
CHANGED
|
@@ -34,7 +34,7 @@ __uri_repository__ = "https://github.com/IGNF/route-graph-generator/"
|
|
|
34
34
|
__uri_tracker__ = f"{__uri_repository__}issues/"
|
|
35
35
|
__uri__ = __uri_repository__
|
|
36
36
|
|
|
37
|
-
__version__ = "2.2.
|
|
37
|
+
__version__ = "2.2.5"
|
|
38
38
|
__version_info__ = tuple(
|
|
39
39
|
[
|
|
40
40
|
int(num) if num.isdigit() else num
|
r2gg/_main.py
CHANGED
|
@@ -407,16 +407,20 @@ def valhalla_convert(config, resource, logger, build_lua_from_cost_config = True
|
|
|
407
407
|
start_command = time.time()
|
|
408
408
|
valhalla_build_config_args = ["valhalla_build_config",
|
|
409
409
|
"--mjolnir-tile-dir", source["storage"]["dir"],
|
|
410
|
-
"--mjolnir-tile-extract", source["storage"]["tar"]
|
|
410
|
+
"--mjolnir-tile-extract", source["storage"]["tar"],
|
|
411
|
+
# Modification des limites par défaut du service : 10h pour isochrone et 1000km pour iso distance
|
|
412
|
+
# contre 2h et 200km par défaut
|
|
413
|
+
"--service-limits-isochrone-max-time-contour", "600",
|
|
414
|
+
"--service-limits-isochrone-max-distance-contour", "1000",
|
|
415
|
+
# Ajout de l'autorisation à exclure les ponts/tunnels/péages
|
|
416
|
+
"--service-limits-allow-hard-exclusions", "True"]
|
|
411
417
|
subprocess_execution(valhalla_build_config_args, logger, outfile = source["storage"]["config"])
|
|
412
418
|
# Nécessaire le temps que le fichier s'écrive...
|
|
413
419
|
time.sleep(1)
|
|
414
|
-
# Ajout du graph custom dans la config valhalla
|
|
420
|
+
# Ajout du graph custom dans la config valhalla (impossible via les paramètres du build_config)
|
|
415
421
|
with open(source["storage"]["config"], "r") as valhalla_config:
|
|
416
422
|
config_dict = json.load(valhalla_config)
|
|
417
423
|
config_dict["mjolnir"]["graph_lua_name"] = source["costs"][0]["compute"]["storage"]["file"]
|
|
418
|
-
# Ajout de l'autorisation à exclure les ponts/tunnels/péages
|
|
419
|
-
config_dict["service_limits"]["allow_hard_exclusions"] = True
|
|
420
424
|
|
|
421
425
|
with open(source["storage"]["config"], "w") as valhalla_config:
|
|
422
426
|
valhalla_config.write(json.dumps(config_dict))
|
r2gg/_pivot_to_pgr.py
CHANGED
|
@@ -395,13 +395,43 @@ def pivot_to_pgr(source, cost_calculation_file_path, connection_work, connection
|
|
|
395
395
|
|
|
396
396
|
for profile_name in profile_names:
|
|
397
397
|
logger.info("Cleaning isolated edges for profile {}...".format(profile_name))
|
|
398
|
-
clean_graph_query = "
|
|
398
|
+
clean_graph_query = """
|
|
399
|
+
WITH connected_components AS (
|
|
400
|
+
SELECT * FROM pgr_connectedComponents(
|
|
401
|
+
'SELECT id, source, target, cost_s_{1} as cost, reverse_cost_s_{1} as reverse_cost FROM {0}.ways'
|
|
402
|
+
)
|
|
403
|
+
),
|
|
404
|
+
remove_nodes AS (
|
|
405
|
+
SELECT node
|
|
406
|
+
FROM
|
|
407
|
+
connected_components
|
|
408
|
+
WHERE
|
|
409
|
+
component = ANY(
|
|
410
|
+
SELECT DISTINCT component
|
|
411
|
+
FROM
|
|
412
|
+
(
|
|
413
|
+
SELECT component, count(*) AS nb
|
|
414
|
+
FROM
|
|
415
|
+
connected_components
|
|
416
|
+
GROUP BY component
|
|
417
|
+
)
|
|
418
|
+
AS components
|
|
419
|
+
WHERE nb <= 10
|
|
420
|
+
)
|
|
421
|
+
)
|
|
422
|
+
UPDATE {0}.ways
|
|
423
|
+
SET cost_s_{1} = -1,
|
|
424
|
+
reverse_cost_s_{1} = -1,
|
|
425
|
+
cost_m_{1} = -1,
|
|
426
|
+
reverse_cost_m_{1} = -1
|
|
427
|
+
WHERE {0}.ways.target = ANY(SELECT * from remove_nodes) OR {0}.ways.source = ANY(SELECT * from remove_nodes);
|
|
428
|
+
""".format(schema, profile_name)
|
|
399
429
|
logger.info("SQL: {}".format(clean_graph_query))
|
|
400
430
|
cursor_isolated.execute(clean_graph_query)
|
|
431
|
+
connection_out.commit()
|
|
401
432
|
|
|
402
433
|
et_execute = time.time()
|
|
403
434
|
logger.info("Execution ended. Elapsed time : %s seconds." %(et_execute - st_execute))
|
|
404
|
-
connection_out.commit()
|
|
405
435
|
cursor_isolated.close()
|
|
406
436
|
|
|
407
437
|
end_time = time.time()
|
r2gg/_subprocess_execution.py
CHANGED
|
@@ -14,7 +14,8 @@ def subprocess_execution(args, logger, outfile = None):
|
|
|
14
14
|
"""
|
|
15
15
|
try:
|
|
16
16
|
str_args = [str(arg) for arg in args]
|
|
17
|
-
|
|
17
|
+
subprocess_arg = " ".join(str_args)
|
|
18
|
+
logger.info('Subprocess: \"' + subprocess_arg + '\"')
|
|
18
19
|
if outfile is not None:
|
|
19
20
|
with open(outfile, "w") as out:
|
|
20
21
|
process = subprocess.Popen(
|
|
@@ -32,6 +33,12 @@ def subprocess_execution(args, logger, outfile = None):
|
|
|
32
33
|
process_output, _ = process.communicate()
|
|
33
34
|
logger.info(process_output.decode("utf-8"))
|
|
34
35
|
|
|
36
|
+
returncode = process.returncode
|
|
37
|
+
if process.returncode != 0:
|
|
38
|
+
error_msg = f"Invalid returncode {returncode} for subprocess '{subprocess_arg}'"
|
|
39
|
+
logger.error(error_msg)
|
|
40
|
+
raise RuntimeError(error_msg)
|
|
41
|
+
|
|
35
42
|
|
|
36
43
|
except (OSError, subprocess.CalledProcessError) as exception:
|
|
37
44
|
logger.info('Exception occured: ' + str(exception))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: r2gg
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.5
|
|
4
4
|
Summary: Route Graph Generator (r2gg) est un script Python qui permet la génération de graphes pour des moteurs de calcul d'itinéraire
|
|
5
5
|
Home-page: https://github.com/IGNF/route-graph-generator/
|
|
6
6
|
Author: IGNF
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
r2gg/__about__.py,sha256=
|
|
1
|
+
r2gg/__about__.py,sha256=Ite9kzvRtV8_PUbjmNiaJAw9qbF-UTbrnuJdaZbF3T4,1343
|
|
2
2
|
r2gg/__init__.py,sha256=zERkbHrNMbNZleuOxsfA7afQExXxpP7-IWVP1IFzNNs,88
|
|
3
3
|
r2gg/_configure.py,sha256=5kNElkBGKR2vmSBNTJtaLPuLNDIiNOsTIGnoA80qzKg,3914
|
|
4
4
|
r2gg/_file_copier.py,sha256=NzDd6ZqxQsQ_EulXg6jZxECUMjlJ0VBtr40-c1Rde-w,578
|
|
5
5
|
r2gg/_lua_builder.py,sha256=NnTDppU-RFsG9ztcICbPVydGE1KciSyvpvOu-GPQmJQ,10249
|
|
6
|
-
r2gg/_main.py,sha256=
|
|
6
|
+
r2gg/_main.py,sha256=r2wOXvZLOp8VR6XF4rS37PVOGZ5MvFyYH0j0VytuI4g,21922
|
|
7
7
|
r2gg/_osm_building.py,sha256=MFFY3EYOVO4rPsYk90Oda70KH1DKW2rlRj8XT4Vx_4U,4227
|
|
8
8
|
r2gg/_osm_to_pbf.py,sha256=ZCGaqao4r2xkwIvKjQSOBd7TVXzO_KDAT2PptnCuAoY,1088
|
|
9
9
|
r2gg/_output_costs_from_costs_config.py,sha256=g7Qy4tlUIOA7DJcwXW9ZxhcOJ5Srq1c8hufylI2e0m8,6208
|
|
10
10
|
r2gg/_path_converter.py,sha256=CTtFHucxTSDB89TMbTO7Q0VqRCs2295GTA4_3cftUVc,340
|
|
11
11
|
r2gg/_pivot_to_osm.py,sha256=sE9q29-C_E5rgZsV7CmQIlG67tEMZRgt4yqUC9FeTGo,8202
|
|
12
|
-
r2gg/_pivot_to_pgr.py,sha256=
|
|
12
|
+
r2gg/_pivot_to_pgr.py,sha256=CWTWnzIWXUMFSneMa_qiEkhc1Bx2s_RxL7l-CWBR6GM,17226
|
|
13
13
|
r2gg/_read_config.py,sha256=VQ6d6Oi1aKHwwURA3KrbpWHK0zP18aJ98XQJiHZb8oI,721
|
|
14
14
|
r2gg/_sql_building.py,sha256=DefYIerZ0k_yltgJFaSzTXAZPSSUH7WAxN3d5FceoWw,840
|
|
15
|
-
r2gg/_subprocess_execution.py,sha256=
|
|
15
|
+
r2gg/_subprocess_execution.py,sha256=NcH3wTwaeOIWA4huSunhnp0qqCkpU6wbHV1w_xqj3C8,1533
|
|
16
16
|
r2gg/_valhalla_lua_builder.py,sha256=vNUnsu4yYQflnNv49-ElxrfIqa4b30vJP740ab7M7rY,13816
|
|
17
17
|
r2gg/cli.py,sha256=2QM7pzvh-iz0kqNsPFtnDiCVAwn63o4GEQK4QwCcgSc,2894
|
|
18
|
-
r2gg-2.2.
|
|
19
|
-
r2gg-2.2.
|
|
20
|
-
r2gg-2.2.
|
|
21
|
-
r2gg-2.2.
|
|
22
|
-
r2gg-2.2.
|
|
23
|
-
r2gg-2.2.
|
|
18
|
+
r2gg-2.2.5.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
19
|
+
r2gg-2.2.5.dist-info/METADATA,sha256=_QAvaf9Q46IrVy9mFX7pEqcXg4jDAtlNsem5vi_PHZg,5013
|
|
20
|
+
r2gg-2.2.5.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
21
|
+
r2gg-2.2.5.dist-info/entry_points.txt,sha256=Km7XbbcVI9jy1TQI0raQfRyKdNGAUIwVkkBG5YeQP4k,275
|
|
22
|
+
r2gg-2.2.5.dist-info/top_level.txt,sha256=fj9IaWXORCdMRcnWWZ7LmvOG4W_sVH8J4BUWf1pM37c,5
|
|
23
|
+
r2gg-2.2.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|