Skip to content

Commit

Permalink
Optimize Z9 rendering
Browse files Browse the repository at this point in the history
Z9 was quite anomaly in terms of rendering time. It was taking much
longer than Z8 and Z10 during pre-computation.

Dominant layer was landuse_gen0. It was using subpixel rendering for
landuse, which is useful at very low zoom but seems to be safely
discardable at Z9.

See as well
gravitystorm/openstreetmap-carto#2874 and
gravitystorm/openstreetmap-carto#3458 (comment).

See #644.
  • Loading branch information
Phyks committed Mar 4, 2023
1 parent 77cf8e2 commit b9f3b0f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions base.mss
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
polygon-gamma: 0.75;
}

#landuse_gen0[zoom>1][zoom<=9],
#landuse_gen1[zoom>9][zoom<=12],
#landuse_gen0[zoom>1][zoom<=8],
#landuse_gen1[zoom>8][zoom<=12],
#landuse[zoom>=13] {
[type='amenity_grave_yard'],
[type='landuse_cemetery'] {
Expand Down
12 changes: 9 additions & 3 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Layer:
CASE WHEN "natural" IS NOT NULL THEN ('natural_' || "natural") ELSE NULL END,
CASE WHEN leisure IS NOT NULL THEN ('leisure_' || leisure) ELSE NULL END,
CASE WHEN amenity IS NOT NULL THEN ('amenity_' || amenity) ELSE NULL END,
CASE WHEN highway IN ('pedestrian') THEN ('highway_' || highway) ELSE NULL END
CASE WHEN highway IS NOT NULL THEN ('highway_' || highway) ELSE NULL END
) AS type,
sport
FROM planet_osm_polygon
Expand All @@ -102,7 +102,7 @@ Layer:
geometry: polygon
properties:
minzoom: 2
maxzoom: 9
maxzoom: 8
- id: landuse_gen1
<<: *extents
Datasource:
Expand All @@ -129,12 +129,13 @@ Layer:
OR highway IN ('pedestrian')
)
AND way_area > 1*!pixel_width!::real*!pixel_height!::real
AND way && !bbox!
ORDER BY way_area DESC
) AS data
geometry: polygon
properties:
cache-features: true
minzoom: 10
minzoom: 9
maxzoom: 12
- id: landuse
<<: *extents
Expand Down Expand Up @@ -182,6 +183,7 @@ Layer:
("natural" = 'wood' OR landuse = 'forest')
AND building IS NULL
AND way_area > 1*!pixel_width!::real*!pixel_height!::real
AND way && !bbox!
ORDER BY way_area DESC
) AS data
geometry: polygon
Expand Down Expand Up @@ -336,6 +338,7 @@ Layer:
OR landuse in ('basin', 'reservoir')
)
AND way_area > 0.1*!pixel_width!::real*!pixel_height!::real
AND way && !bbox!
AND (tunnel IS NULL OR tunnel NOT IN ('yes', 'culvert'))
) AS data
geometry: polygon
Expand Down Expand Up @@ -363,6 +366,7 @@ Layer:
OR landuse in ('basin', 'reservoir')
)
AND way_area > 1*!pixel_width!::real*!pixel_height!::real
AND way && !bbox!
AND (tunnel IS NULL OR tunnel NOT IN ('yes', 'culvert'))
) AS data
geometry: polygon
Expand Down Expand Up @@ -924,6 +928,7 @@ Layer:
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 && !bbox!
) AS protected_areas
properties:
cache-features: true
Expand Down Expand Up @@ -1920,6 +1925,7 @@ Layer:
(landuse = 'military' OR military = 'danger_area')
AND building IS NULL
AND way_area > 1*!pixel_width!::real*!pixel_height!::real
AND way && !bbox!
ORDER BY way_area DESC
) AS data
geometry: polygon
Expand Down

0 comments on commit b9f3b0f

Please sign in to comment.