forked from CartoDB/CartoDB-basemaps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeneralizations.yml
230 lines (213 loc) · 8.88 KB
/
generalizations.yml
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
---
# Since imposm isn't unifying values, we use tags ? 'key' AND tags -> 'key' != 'no'
# Aeroways
- name: aeroways
materialized: false
index_by: the_geom
select: the_geom AS the_geom_webmercator, tags -> 'aeroway' AS type
from: planet
where: tags ? 'aeroway' AND tags -> 'aeroway' != 'no'
# admin-0 and admin-1 boundaries
- name: administrative
materialized: true
cluster_on: the_geom
index_by: the_geom_webmercator
select: tags, tags -> 'admin_level' AS admin_level, the_geom AS the_geom_webmercator
from: planet
where: tags -> 'boundary' = 'administrative'
# Buildings
- name: buildings_z14plus
materialized: true
cluster_on: the_geom
index_by: the_geom_webmercator
select: osm_id, tags -> 'building' building, tags -> 'height' height, ST_Area(the_geom)::bigint AS area, the_geom AS the_geom_webmercator
from: planet
where: tags ? 'building' AND tags -> 'building' != 'no'
- name: buildings_z13
materialized: true
cluster_on: the_geom_webmercator
index_by: the_geom_webmercator
select: osm_id, building, height, area, generalize(the_geom_webmercator,13) as the_geom_webmercator
from: buildings_z14plus
where: area > 10000
# Green Areas
# 1311+160+9
- name: green_areas_z14plus
materialized: false
index_by: the_geom
select: tags -> 'name' AS name, ST_Area(the_geom)::bigint AS area, the_geom AS the_geom_webmercator
from: planet
where: tags -> 'leisure' IN ('park','water_park','marina','nature_reserve','playground',
'garden','common','sports_centre','golf_course','stadium','track','pitch')
OR tags -> 'amenity' IN ('graveyard')
OR tags -> 'landuse' IN ('cemetery','recreation_ground','forest','wood')
- name: green_areas_z13
materialized: true
cluster_on: the_geom_webmercator
index_by: the_geom_webmercator
select: name, area, generalize(the_geom_webmercator,13) as the_geom_webmercator
from: green_areas_z14plus
where: area > 75000
- name: green_areas_z10
materialized: true
cluster_on: the_geom_webmercator
index_by: the_geom_webmercator
select: name, area, generalize(the_geom_webmercator,10) as the_geom_webmercator
from: green_areas_z13
where: area > 5000000
# Water Areas
- name: water_areas_z14plus
materialized: false
index_by: the_geom
select: tags -> 'name' AS name, ST_Area(the_geom)::bigint AS area, COALESCE(tags -> 'natural', tags -> 'waterway', tags -> 'landuse') AS type, the_geom AS the_geom_webmercator
from: planet
where: tags -> 'natural' IN ('water','bay')
OR tags -> 'waterway' IN ('riverbank','canal','river')
OR tags -> 'landuse' IN ('reservoir')
- name: water_areas_z13
materialized: true
cluster_on: the_geom_webmercator
index_by: the_geom_webmercator
select: name, area, type, generalize(the_geom_webmercator,13) as the_geom_webmercator
from: water_areas_z14plus
where: area > 25000 OR type = 'riverbank'
- name: water_areas_z10
materialized: true
cluster_on: the_geom_webmercator
index_by: the_geom_webmercator
select: name, area, type, generalize(the_geom_webmercator,10) as the_geom_webmercator
from: water_areas_z13
where: area > 25000 OR type = 'riverbank'
# Roads
- name: highroad_z15plus
materialized: true
cluster_on: the_geom
index_by: the_geom_webmercator
select: the_geom AS the_geom_webmercator,
tags -> 'highway' as highway,
tags -> 'railway' as railway,
(CASE WHEN tags -> 'highway' IN ('motorway', 'motorway_link') THEN 'highway'
WHEN tags -> 'highway' IN ('trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link') THEN 'major_road'
WHEN tags -> 'highway' IN ('footpath', 'track', 'footway', 'steps', 'pedestrian', 'path', 'cycleway') THEN 'path'
WHEN tags -> 'railway' IN ('rail', 'tram', 'light_rail', 'narrow_guage', 'monorail') THEN 'rail'
ELSE 'minor_road' END) AS kind,
(CASE WHEN tags -> 'highway' IN ('motorway_link','trunk_link','primary_link','secondary_link','tertiary_link') THEN 'yes'
ELSE 'no' END) AS is_link,
(CASE WHEN tags ? 'tunnel' AND tags -> 'tunnel' != 'no' THEN 'yes'
ELSE 'no' END) AS is_tunnel,
(CASE WHEN tags ? 'bridge' AND tags -> 'bridge' != 'no' THEN 'yes'
ELSE 'no' END) AS is_bridge,
wayzorder(tags) as z_order ,
tags -> 'name' as name,
tags -> 'ref' as ref
from: planet
where: tags -> 'highway' IN ('motorway', 'motorway_link')
OR tags -> 'highway' IN ('trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link')
OR tags -> 'highway' IN ('residential', 'unclassified', 'road', 'unclassified', 'service', 'minor')
OR tags -> 'highway' IN ('footpath', 'track', 'footway', 'steps', 'pedestrian', 'path', 'cycleway')
OR tags -> 'railway' IN ('rail', 'tram', 'light_rail', 'narrow_guage', 'monorail')
- name: highroad_z14
materialized: true
cluster_on: the_geom_webmercator
index_by: the_geom_webmercator
select: generalize(the_geom_webmercator, 14) AS the_geom_webmercator,
highway,
railway,
(CASE WHEN highway IN ('motorway', 'motorway_link') THEN 'highway'
WHEN highway IN ('trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link') THEN 'major_road'
WHEN highway IN ('residential', 'unclassified', 'road', 'minor') THEN 'minor_road'
WHEN railway IN ('rail') THEN 'rail'
ELSE 'unknown' END) AS kind,
is_link,
is_tunnel,
is_bridge,
z_order,
name,
ref
from: highroad_z15plus
where: highway in ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'primary',
'primary_link', 'secondary','secondary_link', 'tertiary',
'tertiary_link','residential','unclassified','road','minor')
OR railway = 'rail'
- name: highroad_z13
materialized: true
cluster_on: the_geom_webmercator
index_by: the_geom_webmercator
select: generalize(the_geom_webmercator, 13) AS the_geom_webmercator,
highway,
railway,
(CASE WHEN highway IN ('motorway', 'motorway_link') THEN 'highway'
WHEN highway IN ('trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link') THEN 'major_road'
ELSE 'minor_road' END) AS kind,
is_link,
is_tunnel,
is_bridge,
z_order,
name,
ref
from: highroad_z14
where: highway in ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'primary', 'primary_link', 'secondary','secondary_link', 'tertiary','residential','unclassified','road')
OR railway = 'rail'
- name: highroad_z12
materialized: true
cluster_on: the_geom_webmercator
index_by: the_geom_webmercator
select: generalize(the_geom_webmercator, 12) AS the_geom_webmercator,
highway,
railway,
(CASE WHEN highway IN ('motorway') THEN 'highway'
WHEN highway IN ('trunk', 'secondary', 'primary') THEN 'major_road'
ELSE 'minor_road' END) AS kind,
'no'::text AS is_link,
is_tunnel,
is_bridge,
z_order,
name,
ref
from: highroad_z13
where: highway in ('motorway', 'trunk', 'primary', 'secondary','tertiary','residential','unclassified','road')
- name: highroad_z11
materialized: true
cluster_on: the_geom_webmercator
index_by: the_geom_webmercator
select: generalize(the_geom_webmercator, 11) AS the_geom_webmercator,
highway,
railway,
(CASE WHEN highway IN ('motorway') THEN 'highway'
WHEN highway IN ('trunk', 'primary') THEN 'major_road'
ELSE 'minor_road' END) AS kind,
'no'::text AS is_link,
is_tunnel,
is_bridge,
z_order,
name,
ref
from: highroad_z12
where: highway in ('motorway', 'trunk', 'primary', 'secondary', 'tertiary')
- name: highroad_z10
materialized: true
cluster_on: the_geom_webmercator
index_by: the_geom_webmercator
select: generalize(the_geom_webmercator, 10) AS the_geom_webmercator,
highway,
railway,
(CASE WHEN highway IN ('motorway') THEN 'highway'
WHEN highway IN ('trunk', 'primary') THEN 'major_road'
ELSE 'minor_road' END) AS kind,
'no'::text AS is_link,
is_tunnel,
is_bridge,
z_order,
name,
ref
from: highroad_z11
where: highway in ('motorway', 'trunk', 'primary', 'secondary')
- name: places
materialized: false
index_by: the_geom
select: tags -> 'place' AS place,
tags -> 'name' AS name,
tags -> 'population' AS population,
the_geom AS the_geom_webmercator
from: planet
where: tags -> 'place' IN ('city','town','village','hamlet','suburb','neighbourhood')