This repository has been archived by the owner on Aug 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
global.yaml
158 lines (134 loc) Β· 6.08 KB
/
global.yaml
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
global:
api_key: false # intended to be overwritten by StreetComplete
language: false # intended to be overwritten by StreetComplete
# for online testing (e.g. Tangram Play), language_script is not needed
# for local testing and the final release (e.g. using an emulator):
#language_script: Latn # intended to be overwritten by StreetComplete
text_font_family: 'Roboto'
text_stroke_color: 'white'
text_water_color: '#fff'
text_stroke: { color: global.text_stroke_color, width: 2.5px }
text_places_stroke: { color: global.text_stroke_color, width: 2.5px }
text_countries_stroke: { color: global.text_stroke_color, width: 2.5px }
text_water_stroke: { color: global.water_color, width: 2.5px }
text_fill_color: '#124'
text_size_scaling: 1 # intended to be overwritten by StreetComplete
text_size: |
function() {
var size = 13;
if ($zoom >= 18 && $zoom < 19) {
size = 15;
} else if ($zoom >= 19) {
size = 17;
}
return (size * global.text_size_scaling) + "px";
}
# The following colors are in most cases overwritten
# ones that are used are defined in streetcomplete-light-style.yaml
# and streetcomplete-dark-style.yaml files
railway_color: '#99a'
road_color: '#fff'
highway_color: '#fa8'
highway_outline_color: global.road_outline_color
road_outline_color: '#a88'
path_color: global.road_color
path_outline_color: '#ca9'
square_color: global.road_color
square_outline_color: global.path_outline_color
earth_color: '#f3eacc'
water_color: '#68d'
green_color: '#c6ddaa'
forest_color: '#a8c884'
town_color: '#f3dacd'
building_color: rgb(204,214,238)
building_outline_color: rgb(185,195,217)
boundary_color: '#e39'
oneway_arrow_color: '#888'
barrier_color: '#888'
roundabout_color: global.road_outline_color
tunnel_color: [1., 1., 1., 0.2]
name_source: |
function() {
var userLang = global.language;
if (userLang) {
// Preference #1: Take name in own language (e.g. name:en used in Egypt a lot)
var nameInUserLang = feature['name_'+userLang];
if (nameInUserLang) return nameInUserLang;
// find language of name of element
var elementLang;
var name = feature["name"];
var localizedNameRegex = /^name_([a-z]{2,3})$/;
var keys = Object.keys(feature);
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
if (key == "name") continue;
if (name == feature[key]) {
var match = key.match(localizedNameRegex);
if (match && match.length == 2) {
elementLang = match[1];
break;
}
}
}
if (elementLang && elementLang != userLang) {
var userScript = global.language_script;
// Preference #2 and #3 are not available in JawgMaps
// Preference #2: Take international name (e.g. used in Greece a lot)
//var internationalName = feature["int_name"];
//if (internationalName) return internationalName;
// Preference #3: Take name that is readable in user's script, usually romanized name. Used in Japan a lot
//var nameInUserScript = feature["name_" + elementLang + "-" + userScript];
//if (nameInUserScript) return nameInUserScript;
// NOTE: more correct would be to check elementScript != userScript but the elementScript is hard to find out in pure JavaScript
// Preference #4: Take name in English (cause it's kind of the "international") language
if (userLang != "en") {
var nameInEnglish = feature["name_en"];
if (nameInEnglish) return nameInEnglish;
}
// Preference #5: Take name that is readable in Latin (cause it's kind of "international") script
if (userScript != "Latn") {
var nameInLatinScript = feature["name_ltn"];
if (nameInLatinScript) return nameInLatinScript;
}
// Preference #6: Take name of any other language whose script is the same as the user's script (e.g. French signs in Laos)
// ... not implementable without a mapping of language code to script
// Preference #7: Take name of any other language whose script is in Latin (cause it's kind of "international") script (e.g. French signs in Laos)
// ... not implementable without a mapping of language code to script
}
}
return feature["name"];
}
suggested_min_zoom: |
function() {
return feature.min_zoom <= $zoom
}
sort_rank: function() { return feature.sort_rank; }
scene:
animated: false
background:
color: global.earth_color
camera:
type: perspective
max_tilt: 40
fov: 80
lights:
cameralight:
type: point
diffuse: 0.3
origin: camera
ambient: 0.7
sources:
jawg:
type: MVT
url: https://tile.jawg.io/streets-v2/{z}/{x}/{y}.pbf
max_zoom: 16
url_params:
access-token: global.api_key
textures:
oneway-arrow:
# for online testing (e.g. Tangram Play):
url: https://raw.githubusercontent.com/streetcomplete/streetcomplete-mapstyle/jawg/images/[email protected]
# for local testing and the final release (e.g. using an emulator):
#url: images/[email protected]
filtering: mipmap
density: 5