@@ -159,33 +159,34 @@ themepark:add_table{
159159
160160-- ---------------------------------------------------------------------------
161161
162- local Z_STEP = 14
162+ local Z_STEP_PER_LAYER = 100
163163
164164local highway_lookup = {
165165-- highway tag z minzoom
166- motorway = { 10 , 5 },
167- trunk = { 9 , 6 },
168- primary = { 8 , 8 },
169- secondary = { 7 , 9 },
170- tertiary = { 6 , 10 },
171-
172- tertiary_link = { 5 , 12 },
173- secondary_link = { 5 , 12 },
174- primary_link = { 5 , 12 },
175- trunk_link = { 5 , 12 },
176- motorway_link = { 5 , 12 },
177-
178- unclassified = { 5 , 12 },
179- residential = { 5 , 12 },
180- busway = { 5 , 12 },
181- busway_guideway = { 5 , 12 },
182- road = { 5 , 12 },
166+ motorway = { 34 , 5 },
167+ trunk = { 33 , 6 },
168+ primary = { 32 , 8 },
169+ secondary = { 31 , 9 },
170+ tertiary = { 30 , 10 },
171+
172+ unclassified = { 20 , 12 },
173+ residential = { 20 , 12 },
174+ busway = { 20 , 12 },
175+ busway_guideway = { 20 , 12 },
176+ road = { 20 , 12 },
177+
178+ tertiary_link = { 10 , 12 },
179+ secondary_link = { 10 , 12 },
180+ primary_link = { 10 , 12 },
181+ trunk_link = { 10 , 12 },
182+ motorway_link = { 10 , 12 },
183183
184184 living_street = { 4 , 13 },
185185 pedestrian = { 4 , 13 },
186+
186187 service = { 3 , 13 },
188+ track = { 3 , 13 },
187189
188- track = { 2 , 13 },
189190 footway = { 2 , 13 },
190191 path = { 2 , 13 },
191192 cycleway = { 2 , 13 },
@@ -196,13 +197,13 @@ local highway_lookup = {
196197}
197198
198199local railway_lookup = {
199- rail = { 12 , 8 },
200- narrow_gauge = { 11 , 8 },
201- tram = { 11 , 10 },
202- light_rail = { 11 , 10 },
203- funicular = { 11 , 10 },
204- subway = { 11 , 10 },
205- monorail = { 11 , 10 },
200+ rail = { 52 , 8 },
201+ narrow_gauge = { 51 , 8 },
202+ tram = { 51 , 10 },
203+ light_rail = { 51 , 10 },
204+ funicular = { 51 , 10 },
205+ subway = { 51 , 10 },
206+ monorail = { 51 , 10 },
206207}
207208
208209local aeroway_lookup = {
@@ -246,8 +247,7 @@ themepark:add_proc('node', function(object, data)
246247 geom = object :as_point ()
247248 }
248249 themepark .themes .core .add_name (a , object )
249- themepark :add_debug_info (a , t )
250- themepark :insert (' streets_labels_points' , a )
250+ themepark :insert (' streets_labels_points' , a , t )
251251 end
252252end )
253253
@@ -260,7 +260,7 @@ local process_as_area = function(object, data)
260260 local a = {
261261 layer = data .core .layer ,
262262 }
263- a .z_order = Z_STEP * a .layer
263+ a .z_order = Z_STEP_PER_LAYER * a .layer
264264
265265 if t .highway == ' pedestrian' or t .highway == ' service' then
266266 a .kind = t .highway
@@ -272,25 +272,13 @@ local process_as_area = function(object, data)
272272
273273 a .surface = t .surface
274274
275- if as_bool (t .tunnel ) or t .tunnel == ' building_passage' or t .covered == ' yes' then
276- a .tunnel = true
277- a .z_order = a .z_order - Z_STEP
278- else
279- a .tunnel = false
280- end
281-
282- if as_bool (t .bridge ) then
283- a .bridge = true
284- a .z_order = a .z_order + Z_STEP
285- else
286- a .bridge = false
287- end
275+ a .tunnel = as_bool (t .tunnel ) or t .tunnel == ' building_passage' or t .covered == ' yes'
276+ a .bridge = as_bool (t .bridge )
288277
289278 a .geom = object :as_polygon ()
290279
291280 themepark .themes .core .add_name (a , object )
292- themepark :add_debug_info (a , t )
293- themepark :insert (' street_polygons' , a )
281+ themepark :insert (' street_polygons' , a , t )
294282end
295283
296284themepark :add_proc (' way' , function (object , data )
@@ -339,7 +327,7 @@ themepark:add_proc('way', function(object, data)
339327 a .bicycle = t .bicycle
340328 a .horse = t .horse
341329
342- a .z_order = Z_STEP * a .layer + hwinfo [1 ]
330+ a .z_order = Z_STEP_PER_LAYER * a .layer + hwinfo [1 ]
343331 a .minzoom = hwinfo [2 ]
344332 elseif t .railway then
345333 local rwinfo = railway_lookup [t .railway ]
@@ -349,56 +337,43 @@ themepark:add_proc('way', function(object, data)
349337 a .kind = t .railway
350338 a .rail = true
351339 a .service = t .service
352- a .z_order = Z_STEP * a .layer + rwinfo [1 ]
340+ a .z_order = Z_STEP_PER_LAYER * a .layer + rwinfo [1 ]
353341 a .minzoom = rwinfo [2 ]
354342 if a .minzoom == 8 and t .service then
355343 a .minzoom = 10
356- a .z_order = a .z_order + 1
344+ a .z_order = a .z_order - 2
357345 end
358346 elseif t .aeroway then
359347 local awinfo = aeroway_lookup [t .aeroway ]
360348 if not awinfo then
361349 return
362350 end
363351 a .kind = t .aeroway
364- a .z_order = Z_STEP * a .layer
352+ a .z_order = Z_STEP_PER_LAYER * a .layer
365353 a .minzoom = awinfo
366354 else
367355 return
368356 end
369357
370- if as_bool (t .tunnel ) or t .tunnel == ' building_passage' or t .covered == ' yes' then
371- a .tunnel = true
372- a .z_order = a .z_order - Z_STEP
373- else
374- a .tunnel = false
375- end
376-
377- if as_bool (t .bridge ) then
378- a .bridge = true
379- a .z_order = a .z_order + Z_STEP
380- else
381- a .bridge = false
382- end
358+ a .tunnel = as_bool (t .tunnel ) or t .tunnel == ' building_passage' or t .covered == ' yes'
359+ a .bridge = as_bool (t .bridge )
383360
384361 set_ref_attributes (a , t )
385362
386363 a .geom = object :as_linestring ()
387364
388365 themepark .themes .core .add_name (a , object )
389- themepark :add_debug_info (a , t )
390-
391- themepark :insert (' streets' , a )
366+ themepark :insert (' streets' , a , t )
392367
393368 if a .name or a .ref then
394- themepark :insert (' street_labels' , a )
369+ themepark :insert (' street_labels' , a , t )
395370 end
396371
397372 if a .minzoom < 13 then -- XXX TODO some kind of off-by-one error here?
398- themepark :insert (' streets_med' , a )
373+ themepark :insert (' streets_med' , a , t )
399374 end
400375 if a .minzoom < 10 then -- XXX TODO some kind of off-by-one error here?
401- themepark :insert (' streets_low' , a )
376+ themepark :insert (' streets_low' , a , t )
402377 end
403378end )
404379
0 commit comments