Skip to content

Commit

Permalink
Put max pixel size conditions on ST_PointOnSurface layers
Browse files Browse the repository at this point in the history
We don't want to display points for giant polygons, both because
it's bad cartographically and because it hurts performance.
  • Loading branch information
pnorman committed Feb 26, 2020
1 parent 61e514e commit a836a9b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ Layer:
"natural"
FROM planet_osm_polygon
WHERE way && !bbox!
AND way_area < 768000*POW(!scale_denominator!*0.001*0.28,2)
UNION ALL
SELECT
way,
Expand Down Expand Up @@ -1185,6 +1186,7 @@ Layer:
AND admin_level = '2'
AND name IS NOT NULL
AND way_area > 100*POW(!scale_denominator!*0.001*0.28,2)
AND way_area < 4000000*POW(!scale_denominator!*0.001*0.28,2)
AND osm_id < 0
ORDER BY way_area DESC
) AS country_names
Expand Down Expand Up @@ -1228,7 +1230,8 @@ Layer:
AND boundary = 'administrative'
AND admin_level = '4'
AND name IS NOT NULL
AND way_area > 100*POW(!scale_denominator!*0.001*0.28,2)
AND way_area > 3000*POW(!scale_denominator!*0.001*0.28,2)
AND way_area < 4000000*POW(!scale_denominator!*0.001*0.28,2)
AND osm_id < 0
ORDER BY way_area DESC
) AS state_names
Expand Down Expand Up @@ -1336,6 +1339,7 @@ Layer:
way_area
FROM planet_osm_polygon
WHERE way && !bbox!
AND way_area < 768000*POW(!scale_denominator!*0.001*0.28,2)
UNION ALL
SELECT
way,
Expand Down Expand Up @@ -1389,6 +1393,7 @@ Layer:
FROM planet_osm_polygon
WHERE way && !bbox!
AND junction = 'yes'
AND way_area < 768000*POW(!scale_denominator!*0.001*0.28,2)
ORDER BY way_pixels DESC NULLS LAST
) AS junctions
properties:
Expand All @@ -1407,6 +1412,8 @@ Layer:
FROM planet_osm_polygon
WHERE way && !bbox!
AND man_made = 'bridge'
AND way_area > 62.5*POW(!scale_denominator!*0.001*0.28,2)
AND way_area < 64000*POW(!scale_denominator!*0.001*0.28,2)
ORDER BY way_area DESC
) AS bridge_text
properties:
Expand Down Expand Up @@ -1794,6 +1801,8 @@ Layer:
OR (place IN ('square')
AND (leisure IS NULL OR NOT leisure IN ('park', 'recreation_ground', 'garden'))))
AND name IS NOT NULL
AND way_area > 3000*POW(!scale_denominator!*0.001*0.28,2)
AND way_area < 768000*POW(!scale_denominator!*0.001*0.28,2)
ORDER BY way_area DESC
) AS roads_area_text_name
properties:
Expand Down Expand Up @@ -1990,6 +1999,7 @@ Layer:
OR leisure IN ('nature_reserve'))
AND building IS NULL
AND name IS NOT NULL
AND way_area > 100*POW(!scale_denominator!*0.001*0.28,2)
AND way_area < 768000*POW(!scale_denominator!*0.001*0.28,2)
ORDER BY way_area DESC
) AS text_poly_low_zoom
Expand Down Expand Up @@ -2045,6 +2055,7 @@ Layer:
AND building IS NOT NULL
AND building NOT IN ('no')
AND name IS NOT NULL
AND way_area < 4000000*POW(!scale_denominator!*0.001*0.28,2)
ORDER BY way_area DESC
) AS building_text
properties:
Expand Down Expand Up @@ -2077,6 +2088,7 @@ Layer:
FROM planet_osm_polygon
WHERE way && !bbox! AND (("addr:housenumber" IS NOT NULL) OR ("addr:housename" IS NOT NULL) OR ((tags->'addr:unit') IS NOT NULL))
AND building IS NOT NULL
AND way_area < 4000000*POW(!scale_denominator!*0.001*0.28,2)
UNION ALL
SELECT
way,
Expand Down Expand Up @@ -2208,6 +2220,7 @@ Layer:
way_area
FROM planet_osm_polygon
WHERE way && !bbox!
AND way_area < 768000*POW(!scale_denominator!*0.001*0.28,2)
UNION ALL
SELECT
way,
Expand Down

0 comments on commit a836a9b

Please sign in to comment.