Skip to content

Commit

Permalink
Splitted project.mml
Browse files Browse the repository at this point in the history
  • Loading branch information
giggls committed May 29, 2022
1 parent db9abe2 commit 4421ff3
Show file tree
Hide file tree
Showing 81 changed files with 2,367 additions and 0 deletions.
33 changes: 33 additions & 0 deletions project.mml.d/addresses
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
- id: addresses
geometry: point
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
ST_PointOnSurface(way) AS way,
"addr:housenumber" AS addr_housenumber,
"addr:housename" AS addr_housename,
tags->'addr:unit' AS addr_unit,
tags->'addr:flats' AS addr_flats,
way_area/NULLIF(POW(!scale_denominator!*0.001*0.28,2),0) AS way_pixels
FROM planet_osm_polygon
WHERE way && !bbox! -- Not ST_PointOnSurface(way) because name might be NULL
AND (("addr:housenumber" IS NOT NULL) OR ("addr:housename" IS NOT NULL) OR ((tags->'addr:unit') IS NOT NULL) OR ((tags->'addr:flats') IS NOT NULL))
AND building IS NOT NULL
AND way_area < 4000000*POW(!scale_denominator!*0.001*0.28,2)
UNION ALL
SELECT
way,
"addr:housenumber" AS addr_housenumber,
"addr:housename" AS addr_housename,
tags->'addr:unit' AS addr_unit,
tags->'addr:flats' AS addr_flats,
NULL AS way_pixels
FROM planet_osm_point
WHERE way && !bbox!
AND (("addr:housenumber" IS NOT NULL) OR ("addr:housename" IS NOT NULL) OR ((tags->'addr:unit') IS NOT NULL) OR ((tags->'addr:flats') IS NOT NULL))
ORDER BY way_pixels DESC NULLS LAST
) AS addresses
properties:
minzoom: 17
17 changes: 17 additions & 0 deletions project.mml.d/admin-high-zoom
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- id: admin-high-zoom
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
admin_level
FROM planet_osm_roads
WHERE boundary = 'administrative'
AND admin_level IN ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10')
AND osm_id < 0
ORDER BY admin_level::integer DESC -- With 10 as a valid value, we need to do a numeric ordering, not a text ordering
) AS admin_high_zoom
properties:
minzoom: 13
18 changes: 18 additions & 0 deletions project.mml.d/admin-low-zoom
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- id: admin-low-zoom
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
admin_level
FROM planet_osm_roads
WHERE boundary = 'administrative'
AND admin_level IN ('0', '1', '2', '3', '4')
AND osm_id < 0
ORDER BY admin_level DESC
) AS admin_low_zoom
properties:
minzoom: 4
maxzoom: 7
18 changes: 18 additions & 0 deletions project.mml.d/admin-mid-zoom
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- id: admin-mid-zoom
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
admin_level
FROM planet_osm_roads
WHERE boundary = 'administrative'
AND admin_level IN ('0', '1', '2', '3', '4', '5', '6', '7', '8')
AND osm_id < 0
ORDER BY admin_level DESC
) AS admin_mid_zoom
properties:
minzoom: 8
maxzoom: 12
21 changes: 21 additions & 0 deletions project.mml.d/admin-text
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
- id: admin-text
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
name,
admin_level,
way_area/NULLIF(POW(!scale_denominator!*0.001*0.28,2),0) AS way_pixels
FROM planet_osm_polygon
WHERE boundary = 'administrative'
AND admin_level IN ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10')
AND name IS NOT NULL
AND osm_id < 0
AND way_area > 196000*POW(!scale_denominator!*0.001*0.28,2)
ORDER BY admin_level::integer ASC, way_area DESC
) AS admin_text
properties:
minzoom: 11
29 changes: 29 additions & 0 deletions project.mml.d/aerialways
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
- id: aerialways
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
aerialway,
man_made,
tags->'substance' AS substance
FROM planet_osm_line
WHERE aerialway IS NOT NULL
OR (man_made = 'pipeline'
AND tags-> 'location' IN ('overground', 'overhead', 'surface', 'outdoor')
OR bridge IN ('yes', 'aqueduct', 'cantilever', 'covered', 'trestle', 'viaduct'))
OR (man_made = 'goods_conveyor'
AND (tags->'location' NOT IN ('underground') OR (tags->'location') IS NULL)
AND (tunnel NOT IN ('yes') OR tunnel IS NULL))
ORDER BY
CASE
WHEN man_made IN ('goods_conveyor', 'pipeline') THEN 1
WHEN tags-> 'location' = 'overhead' THEN 2
WHEN bridge IS NOT NULL THEN 3
WHEN aerialway IS NOT NULL THEN 4
END
) AS aerialways
properties:
minzoom: 12
18 changes: 18 additions & 0 deletions project.mml.d/aeroways
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- id: aeroways
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
aeroway,
bridge IN ('yes', 'boardwalk', 'cantilever', 'covered', 'low_water_crossing', 'movable', 'trestle', 'viaduct') AS bridge
FROM planet_osm_line
WHERE aeroway IN ('runway', 'taxiway')
ORDER BY bridge NULLS FIRST,
CASE WHEN aeroway = 'runway' THEN 1 ELSE 0 END
) AS aeroways
properties:
cache-features: true
minzoom: 11
22 changes: 22 additions & 0 deletions project.mml.d/amenity-line
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
- id: amenity-line
geometry: linestring
<<: *extents
Datasource:
<<: *osm2pgsql
table: |-
(SELECT
way,
COALESCE(
'highway_' || CASE WHEN tags @> 'ford=>yes' OR tags @> 'ford=>stepping_stones' THEN 'ford' END,
'leisure_' || CASE WHEN leisure IN ('slipway', 'track') THEN leisure END,
'attraction_' || CASE WHEN tags @> 'attraction=>water_slide' THEN 'water_slide' END
) AS feature
FROM planet_osm_line
-- The upcoming where clause is needed for performance only, as the CASE statements would end up doing the equivalent filtering
WHERE tags @> 'ford=>yes' OR tags @> 'ford=>stepping_stones'
OR leisure IN ('slipway', 'track')
OR tags @> 'attraction=>water_slide'
ORDER BY COALESCE(layer,0)
) AS amenity_line
properties:
minzoom: 16
68 changes: 68 additions & 0 deletions project.mml.d/amenity-low-priority
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
- id: amenity-low-priority
geometry: point
<<: *extents
Datasource:
<<: *osm2pgsql
table: &amenity_low_priority_sql |-
(SELECT
way,
name,
COALESCE(
'railway_' || CASE WHEN railway IN ('level_crossing', 'crossing') AND way_area IS NULL THEN railway END,
'amenity_' || CASE WHEN amenity IN ('bench', 'waste_basket', 'waste_disposal') AND way_area IS NULL THEN amenity END,
'historic_' || CASE WHEN historic IN ('wayside_cross', 'wayside_shrine') AND way_area IS NULL THEN historic END,
'man_made_' || CASE WHEN man_made IN ('cross') AND way_area IS NULL THEN man_made END,
'barrier_' || CASE WHEN barrier IN ('bollard', 'gate', 'lift_gate', 'swing_gate', 'block', 'log', 'cattle_grid', 'stile', 'motorcycle_barrier', 'cycle_barrier', 'full-height_turnstile', 'turnstile', 'kissing_gate') THEN barrier END
) AS feature,
access,
way_area,
way_area/NULLIF(POW(!scale_denominator!*0.001*0.28,2),0) AS way_pixels
FROM
(SELECT
ST_PointOnSurface(way) AS way,
name,
access,
amenity,
barrier,
highway,
historic,
man_made,
railway,
tags,
way_area
FROM planet_osm_polygon
WHERE way && !bbox! -- Not ST_PointOnSurface(way) because name might be NULL
AND way_area < 768000*POW(!scale_denominator!*0.001*0.28,2)
UNION ALL
SELECT
way,
name,
access,
amenity,
barrier,
highway,
historic,
man_made,
railway,
tags,
NULL AS way_area
FROM planet_osm_point
WHERE way && !bbox!
) _
WHERE railway IN ('level_crossing', 'crossing')
OR amenity IN ('bench', 'waste_basket', 'waste_disposal')
OR historic IN ('wayside_cross', 'wayside_shrine')
OR man_made IN ('cross')
OR barrier IN ('bollard', 'gate', 'lift_gate', 'swing_gate', 'block', 'log', 'cattle_grid', 'stile', 'motorcycle_barrier', 'cycle_barrier', 'full-height_turnstile', 'turnstile', 'kissing_gate')
ORDER BY
CASE amenity
WHEN 'waste_basket' THEN 1
WHEN 'waste_disposal' THEN 1
WHEN 'bench' THEN 2
WHEN NULL THEN 3
END DESC,
way_pixels DESC NULLS LAST
) AS amenity_low_priority
properties:
cache-features: true
minzoom: 14
Loading

0 comments on commit 4421ff3

Please sign in to comment.