pyvalhalla-git 3.5.1.post132__cp310-cp310-win_amd64.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.
Files changed (38) hide show
  1. _valhalla.cp310-win_amd64.pyd +0 -0
  2. pyvalhalla_git-3.5.1.post132.data/platlib/Lerc-d4ff05a506ddcfc551c350aa718ab4da.dll +0 -0
  3. pyvalhalla_git-3.5.1.post132.data/platlib/abseil_dll-bdd8a5a1f5a4da3f67279509940f7994.dll +0 -0
  4. pyvalhalla_git-3.5.1.post132.data/platlib/gdal-e68c9d36ee94002182307d221cc91ce3.dll +0 -0
  5. pyvalhalla_git-3.5.1.post132.data/platlib/geos-b8640de6faf146d9855a807e72427e47.dll +0 -0
  6. pyvalhalla_git-3.5.1.post132.data/platlib/geos_c-7d79920a3a18ad2c1ff594fcef060f0a.dll +0 -0
  7. pyvalhalla_git-3.5.1.post132.data/platlib/geotiff-020296779aedd28fd03f34200e6e3c61.dll +0 -0
  8. pyvalhalla_git-3.5.1.post132.data/platlib/jpeg62-52d863f4f0f8139faf1608976c1d91f6.dll +0 -0
  9. pyvalhalla_git-3.5.1.post132.data/platlib/json-c-0d6db73c6075abe84a7bdd2a2d393471.dll +0 -0
  10. pyvalhalla_git-3.5.1.post132.data/platlib/libcurl-bfd466d47923540033e77b192031a728.dll +0 -0
  11. pyvalhalla_git-3.5.1.post132.data/platlib/libexpat-6da76b3644b9424613b6d75323fcdc82.dll +0 -0
  12. pyvalhalla_git-3.5.1.post132.data/platlib/liblzma-9b97b163f3fff34e786ef56c4f919383.dll +0 -0
  13. pyvalhalla_git-3.5.1.post132.data/platlib/libpng16-45e0d625267ecee5996170051645e533.dll +0 -0
  14. pyvalhalla_git-3.5.1.post132.data/platlib/libprotobuf-lite-2bea258fef20ab8f71dcb2fec86675a8.dll +0 -0
  15. pyvalhalla_git-3.5.1.post132.data/platlib/lz4-cb6b9d0ac653fc68b286ff6ba7ef9bf5.dll +0 -0
  16. pyvalhalla_git-3.5.1.post132.data/platlib/msvcp140-73e7ea186a7d9ab676a764ffa64cf7e6.dll +0 -0
  17. pyvalhalla_git-3.5.1.post132.data/platlib/proj_9-3a2a70c01b92ddd4e14ab2bc22e06ab7.dll +0 -0
  18. pyvalhalla_git-3.5.1.post132.data/platlib/qhull_r-46ecfc2e889bb30a2c3af738edb6eeb9.dll +0 -0
  19. pyvalhalla_git-3.5.1.post132.data/platlib/sqlite3-219685aef036100e03dd97e60c61281d.dll +0 -0
  20. pyvalhalla_git-3.5.1.post132.data/platlib/tiff-f8c8a1908722e0556fad08f0b5c1bb6f.dll +0 -0
  21. pyvalhalla_git-3.5.1.post132.data/platlib/zlib1-8425906e295d322425fe840dc45228db.dll +0 -0
  22. pyvalhalla_git-3.5.1.post132.dist-info/DELVEWHEEL +2 -0
  23. pyvalhalla_git-3.5.1.post132.dist-info/METADATA +137 -0
  24. pyvalhalla_git-3.5.1.post132.dist-info/RECORD +38 -0
  25. pyvalhalla_git-3.5.1.post132.dist-info/WHEEL +5 -0
  26. pyvalhalla_git-3.5.1.post132.dist-info/licenses/AUTHORS +5 -0
  27. pyvalhalla_git-3.5.1.post132.dist-info/licenses/COPYING +22 -0
  28. pyvalhalla_git-3.5.1.post132.dist-info/licenses/LICENSE.md +1 -0
  29. pyvalhalla_git-3.5.1.post132.dist-info/top_level.txt +2 -0
  30. valhalla/__init__.py +22 -0
  31. valhalla/__main__.py +72 -0
  32. valhalla/__version__.py +21 -0
  33. valhalla/_scripts.py +46 -0
  34. valhalla/_valhalla.cc +81 -0
  35. valhalla/actor.py +118 -0
  36. valhalla/config.py +45 -0
  37. valhalla/utils.py +62 -0
  38. valhalla/valhalla_build_config.py +760 -0
valhalla/config.py ADDED
@@ -0,0 +1,45 @@
1
+ from pathlib import Path
2
+ from typing import Union, Dict
3
+
4
+ from .valhalla_build_config import config as default_config, Optional, help_text
5
+
6
+
7
+ def _sanitize_config(dict_: dict = None) -> dict:
8
+ """remove the "Optional" values from the config."""
9
+ int_dict_ = dict_.copy()
10
+ for k, v in int_dict_.items():
11
+ if isinstance(v, Optional):
12
+ del dict_[k]
13
+ elif isinstance(v, dict):
14
+ _sanitize_config(v)
15
+
16
+ return dict_
17
+
18
+
19
+ def get_help() -> Dict[str, Union[Dict[str, str], str]]:
20
+ """
21
+ Returns the help dictionary with the same keys as the config JSON.
22
+ """
23
+ return help_text
24
+
25
+
26
+ def get_config(
27
+ tile_extract: Union[str, Path] = "valhalla_tiles.tar",
28
+ tile_dir: Union[str, Path] = "valhalla_tiles",
29
+ verbose: bool = False,
30
+ ) -> dict:
31
+ """
32
+ Returns a default Valhalla configuration.
33
+
34
+ :param tile_extract: The file path (with .tar extension) of the tile extract (mjolnir.tile_extract), if present. Preferred over tile_dir.
35
+ :param tile_dir: The directory path where the graph tiles are stored (mjolnir.tile_dir), if present.
36
+ :param verbose: Whether you want to see Valhalla's logs on stdout (mjolnir.logging). Default False.
37
+ """
38
+
39
+ config = _sanitize_config(default_config.copy())
40
+
41
+ config["mjolnir"]["tile_dir"] = str(Path(tile_dir).resolve())
42
+ config["mjolnir"]["tile_extract"] = str(Path(tile_extract).resolve())
43
+ config["mjolnir"]["logging"]["type"] = "std_out" if verbose else ""
44
+
45
+ return config
valhalla/utils.py ADDED
@@ -0,0 +1,62 @@
1
+ from typing import List, Tuple
2
+
3
+
4
+ def decode_polyline(
5
+ polyline: str, precision: int = 6, order: str = "lnglat"
6
+ ) -> List[Tuple[float, float]]:
7
+ """Decodes an encoded ``polyline`` string with ``precision`` to a list of coordinate tuples.
8
+ The coordinate ``order`` of the output can be ``lnglat`` or ``latlng``."""
9
+
10
+ return _decode(polyline, precision=precision, order=order, is3d=False)
11
+
12
+
13
+ def _trans(value, index):
14
+ """
15
+ Copyright (c) 2014 Bruno M. Custódio
16
+ Copyright (c) 2016 Frederick Jansen
17
+ https://github.com/hicsail/polyline/commit/ddd12e85c53d394404952754e39c91f63a808656
18
+ """
19
+ byte, result, shift = None, 0, 0
20
+
21
+ while byte is None or byte >= 0x20:
22
+ byte = ord(value[index]) - 63
23
+ index += 1
24
+ result |= (byte & 0x1F) << shift
25
+ shift += 5
26
+ comp = result & 1
27
+
28
+ return ~(result >> 1) if comp else (result >> 1), index
29
+
30
+
31
+ def _decode(expression, precision=5, order="lnglat", is3d=False):
32
+ """
33
+ Copyright (c) 2014 Bruno M. Custódio
34
+ Copyright (c) 2016 Frederick Jansen
35
+ https://github.com/hicsail/polyline/commit/ddd12e85c53d394404952754e39c91f63a808656
36
+
37
+ Modified to be able to work with 3D polylines and a specified coordinate order.
38
+ """
39
+ coordinates, index, lat, lng, z, length, factor = (
40
+ [],
41
+ 0,
42
+ 0,
43
+ 0,
44
+ 0,
45
+ len(expression),
46
+ float(10**precision),
47
+ )
48
+
49
+ while index < length:
50
+ lat_change, index = _trans(expression, index)
51
+ lng_change, index = _trans(expression, index)
52
+ lat += lat_change
53
+ lng += lng_change
54
+ coord = (lat / factor, lng / factor) if order == "latlng" else (lng / factor, lat / factor)
55
+ if not is3d:
56
+ coordinates.append(coord)
57
+ else:
58
+ z_change, index = _trans(expression, index)
59
+ z += z_change
60
+ coordinates.append((*coord, z / 100))
61
+
62
+ return coordinates