This repository has been archived by the owner on Mar 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata.yml
258 lines (258 loc) · 7.58 KB
/
data.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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
_prefs:
disabled: []
inspector: false
mapid: ''
rev: ''
saveCenter: false
name: OSM Clear
description: A style designed for use with ClearTables
attribution: 'Data © OpenStreetMap contributors'
center:
- 0
- 0
- 4
minzoom: 0
maxzoom: 16
# Various parts to be included later on
_parts:
# Extents are used for tilemill, and don't actually make it to the generated XML
extents: &extents
extent: -20037508,-20037508,20037508,20037508
srs-name: "900913"
srs: "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over"
osm2pgsql: &osm2pgsql
type: postgis
dbname: "gis"
key_field: ""
geometry_field: "way"
extent: "-20037508,-20037508,20037508,20037508"
Layer:
- id: water
geometry: polygon
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way
FROM water_areas
WHERE way_area > 0.01*!pixel_width!::real*!pixel_height!::real
AND z(!scale_denominator!) >= 6
UNION ALL
SELECT
way
FROM ocean
WHERE z(!scale_denominator!) >= 10
UNION ALL
SELECT
way
FROM simplified_ocean
WHERE z(!scale_denominator!) < 10
) AS water
- id: waterways
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
waterway,
brunnel,
intermittent
FROM waterways
WHERE waterway IN ('river')
OR (z(!scale_denominator!) >= 7 AND waterway IN ('canal'))
OR (z(!scale_denominator!) >= 11 AND waterway IN ('stream'))
OR (z(!scale_denominator!) >= 13 AND waterway IN ('drain', 'ditch'))
ORDER BY layer
) AS waterways
properties:
minzoom: 5
- id: buildings
geometry: polygon
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
-- 3.66 is obtained by correlating the heights and level data in OSM
-- raising to a power < 1 reduces the height range displayed which looks better
least(greatest(3, COALESCE(height,levels*3.66,5)),400)^.7 AS render_height
FROM buildings
WHERE way_area > 0.01*!pixel_width!::real*!pixel_height!::real
ORDER BY render_height, ST_YMin(way) DESC
) AS buildings
properties:
minzoom: 12
- id: transportation-back-casing
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: &transport_query |-
(SELECT
way,
class::text,
layer,
ramp,
brunnel::text -- does this need to be text?
FROM (SELECT
way,
class,
layer,
brunnel,
ramp,
NULL::real AS way_area
FROM roads
WHERE class IN ('motorway','trunk','primary')
OR (z(!scale_denominator!) >= 6 AND class IN ('secondary'))
OR (z(!scale_denominator!) >= 8 AND class IN ('tertiary'))
OR (z(!scale_denominator!) >= 11 AND class IN ('minor'))
OR z(!scale_denominator!) >= 12
UNION ALL
SELECT
way,
class,
layer,
brunnel,
NULL::boolean AS ramp,
NULL::real AS way_area
FROM rail
UNION ALL
SELECT
way,
class,
layer,
brunnel,
NULL::boolean AS ramp,
way_area
FROM road_areas
WHERE z(!scale_denominator!) >= 12
ORDER BY layer,
class,
way_area DESC NULLS LAST) AS q
) AS transportation
properties:
minzoom: 4
- id: transportation
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: *transport_query
advanced: {}
properties:
group-by: layer
minzoom: 4
- id: aeroway
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
aeroway
FROM
aeroway_line
) AS aeroway
properties:
minzoom: 10
- id: place
geometry: point
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
name,
class::text,
rank::text
FROM
(SELECT
DISTINCT ON (ST_SnapToGrid(way, !pixel_width!::real*8, !pixel_height!::real*8))
*
FROM
(SELECT
way,
name,
class,
rank,
population,
NULL::float AS way_area
FROM place_point
WHERE way && !bbox!
UNION ALL
SELECT
ST_PointOnSurface(way) AS way,
name,
class,
rank,
population,
way_area
FROM place_polygon
WHERE way && !bbox!
) AS p
WHERE way && !bbox!
AND name IS NOT NULL
AND rank IN ('city')
OR (z(!scale_denominator!) >= 6 AND rank >='town' AND class = 'settlement')
OR (z(!scale_denominator!) >= 8 AND rank >='village' AND class = 'settlement')
OR (z(!scale_denominator!) >= 10 AND rank >='hamlet' AND class = 'settlement')
-- todo: add subregions
-- Place labels are well-known for being finicky for cut-off labels
-- This includes terms which aren't needed directly, but are required
-- to get consistent ordering across tile bounds.
ORDER BY
ST_SnapToGrid(way, !pixel_width!::real*8, !pixel_height!::real*8),
CASE class
WHEN 'settlement' THEN 10
WHEN 'subregion' THEN 5
WHEN 'locality' THEN 2 ELSE 1
END DESC,
p.rank DESC, -- order by the enum, not text
population DESC NULLS LAST,
way_area DESC NULLS LAST,
length(name) DESC,
name
) AS p
-- This is the same ordering as above, just without the grid.
ORDER BY
CASE class
WHEN 'settlement' THEN 10
WHEN 'subregion' THEN 5
WHEN 'locality' THEN 2 ELSE 1
END DESC,
p.rank DESC, -- order by the enum, not text
population DESC NULLS LAST,
way_area DESC NULLS LAST,
length(name) DESC,
name
) AS place
properties:
"buffer-size": 192
- id: roads-text
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
name,
class::text,
layer,
brunnel::text
FROM roads
WHERE name IS NOT NULL
AND class IN ('motorway','trunk','primary')
OR (z(!scale_denominator!) >= 6 AND class IN ('secondary'))
OR (z(!scale_denominator!) >= 8 AND class IN ('tertiary'))
OR (z(!scale_denominator!) >= 11 AND class IN ('minor'))
OR z(!scale_denominator!) >= 12
ORDER BY layer, class) AS road_text
properties:
minzoom: 4