Skip to content

Commit

Permalink
Use mapnik scale-independent pixel size expressions
Browse files Browse the repository at this point in the history
!pixel_height! and !pixel_width! do not work for area-based filtering
when using high dpi rendering. Instead, !scale_denominator! needs to
be used.
  • Loading branch information
pnorman committed Feb 26, 2020
1 parent 2b793ea commit 61e514e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Layer:
FROM planet_osm_polygon
WHERE (landuse IN ('forest', 'farmland', 'residential', 'commercial', 'retail', 'industrial', 'meadow', 'grass', 'village_green', 'vineyard', 'orchard')
OR "natural" IN ('wood', 'wetland', 'mud', 'sand', 'scree', 'shingle', 'bare_rock', 'heath', 'grassland', 'scrub'))
AND way_area > 0.01*!pixel_width!::real*!pixel_height!::real
AND way_area > 0.01*POW(!scale_denominator!*0.001*0.28,2)
AND building IS NULL
) AS features
ORDER BY way_area DESC, feature
Expand Down Expand Up @@ -133,7 +133,7 @@ Layer:
OR tourism IN ('camp_site', 'caravan_site', 'picnic_site')
OR highway IN ('services', 'rest_area')
OR railway = 'station')
AND way_area > 1*!pixel_width!::real*!pixel_height!::real
AND way_area > 1*POW(!scale_denominator!*0.001*0.28,2)
) AS landcover
ORDER BY way_area DESC, feature
) AS features
Expand Down Expand Up @@ -241,7 +241,7 @@ Layer:
OR landuse IN ('reservoir', 'basin')
OR "natural" IN ('water', 'glacier'))
AND building IS NULL
AND way_area > 1*!pixel_width!::real*!pixel_height!::real
AND way_area > 1*POW(!scale_denominator!*0.001*0.28,2)
ORDER BY COALESCE(layer,0), way_area DESC
) AS water_areas
properties:
Expand Down Expand Up @@ -287,7 +287,7 @@ Layer:
FROM planet_osm_polygon
WHERE ("natural" IN ('mud', 'wetland', 'wood', 'beach', 'shoal', 'reef', 'scrub', 'sand') OR landuse = 'forest')
AND building IS NULL
AND way_area > 1*!pixel_width!::real*!pixel_height!::real
AND way_area > 1*POW(!scale_denominator!*0.001*0.28,2)
ORDER BY COALESCE(layer,0), way_area DESC
) AS landcover_area_symbols
properties:
Expand Down Expand Up @@ -437,7 +437,7 @@ Layer:
FROM planet_osm_polygon
WHERE building IS NOT NULL
AND building != 'no'
AND way_area > 1*!pixel_width!::real*!pixel_height!::real
AND way_area > 1*POW(!scale_denominator!*0.001*0.28,2)
ORDER BY COALESCE(layer,0), way_area DESC
) AS buildings
properties:
Expand Down Expand Up @@ -1145,7 +1145,7 @@ Layer:
OR leisure = 'nature_reserve'
OR (boundary = 'protected_area' AND tags->'protect_class' IN ('1','1a','1b','2','3','4','5','6','7','24','97','98','99')))
AND building IS NULL
AND way_area > 1*!pixel_width!::real*!pixel_height!::real
AND way_area > 1*POW(!scale_denominator!*0.001*0.28,2)
) AS protected_areas
properties:
cache-features: true
Expand Down Expand Up @@ -1184,7 +1184,7 @@ Layer:
AND boundary = 'administrative'
AND admin_level = '2'
AND name IS NOT NULL
AND way_area > 100*!pixel_width!::real*!pixel_height!::real
AND way_area > 100*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 +1228,7 @@ Layer:
AND boundary = 'administrative'
AND admin_level = '4'
AND name IS NOT NULL
AND way_area > 100*!pixel_width!::real*!pixel_height!::real
AND way_area > 100*POW(!scale_denominator!*0.001*0.28,2)
AND osm_id < 0
ORDER BY way_area DESC
) AS state_names
Expand Down

0 comments on commit 61e514e

Please sign in to comment.