-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path_util.py
79 lines (60 loc) · 1.41 KB
/
_util.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import numpy as np
def to_bytes(x: int, length: int) -> bytes:
x = [None, np.uint8, np.uint16, None, np.uint32][length](x)
# func copied from https://github.com/Gael-de-Sailly/geo-mapgen/blob/4bacbe902e7c0283a24ee3efa35c283ad592e81c/database.py#L34
res = x.newbyteorder("<").tobytes()
assert len(res) == length
return res
def from_bytes(b):
return int.from_bytes(b, "little")
SURFACES = {
"default": 0,
"paving_stones": 1,
"fine_gravel": 2,
"concrete": 3,
"asphalt": 4,
"dirt": 5,
"highway": 10, # default
"footway": 11,
"service": 12,
"cycleway": 13,
"pedestrian": 14,
"residential": 15,
"path": 16,
"leisure": 20, # default
"park": 21,
"playground": 22,
"sports_centre": 23,
"pitch": 24,
"amenity": 30, # default
"school": 31,
"parking": 32,
"landuse": 40, # default
"residential_landuse": 41,
"village_green": 42,
"natural": 50, # default
"water": 51,
"building_ground": 60,
"grass": 70
}
DECORATIONS = {
"none": 0, # air
"natural": 10, # default
"grass": 11,
"tree": 12,
"leaf_tree": 13,
"conifer": 14,
"bush": 15,
# amenity
"post_box": 21,
"recycling": 22,
"vending_machine": 23,
"bench": 24,
"telephone": 25,
"barrier": 30, # default
"fence": 31,
"wall": 32,
"bollard": 33,
"gate": 34,
"hedge": 35
}