Skip to content

Commit

Permalink
Disable colors due to z-fighting
Browse files Browse the repository at this point in the history
  • Loading branch information
bchapuis committed Nov 10, 2023
1 parent f9313b9 commit 5d0aaa7
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 37 deletions.
16 changes: 10 additions & 6 deletions basemap/layers/building/extrusion.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ export default {
},
minzoom: 15,
paint: {
"fill-extrusion-color": [
"case",
["has", "building:colour"],
["get", "building:colour"],
theme.buildingShapeFillColor,
],
"fill-extrusion-color": theme.buildingShapeFillColor,
// Having muliple colors for building parts results in z-fighting
// https://github.com/maplibre/maplibre-gl-js/issues/3157
// https://github.com/maplibre/maplibre-gl-js/issues/3187
// "fill-extrusion-color": [
// "case",
// ["has", "building:colour"],
// ["get", "building:colour"],
// theme.buildingShapeFillColor,
// ],
"fill-extrusion-base": [
'interpolate',
['linear'],
Expand Down
66 changes: 35 additions & 31 deletions basemap/layers/building/tileset.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,47 +22,51 @@ export default {
minzoom: 13,
maxzoom: 20,
sql: `
SELECT
id,
SELECT
id,
tags
|| jsonb_build_object('extrusion:base', (CASE
WHEN tags ? 'building:min_height'
THEN tags ->> 'building:min_height'
WHEN tags ->> 'building:min_level' ~ '^[0-9\\\\\\\\.]+$'
THEN tags ->> 'building:min_level'
ELSE '0' END)::real * 3)
WHEN tags ? 'building:min_height'
THEN (tags ->> 'building:min_height')::real
WHEN tags ->> 'building:min_level' ~ '^[0-9.]+$'
THEN (tags ->> 'building:min_level')::real * 3
ELSE 0 END))
|| jsonb_build_object('extrusion:height', (CASE
WHEN tags ? 'building:height'
THEN tags ->> 'building:height'
WHEN tags ->> 'building:levels' ~ '^[0-9\\\\\\\\.]+$'
THEN tags ->> 'building:levels'
ELSE '2' END)::real * 3) as tags,
geom
FROM osm_ways
WHERE tags ? 'building'`,
WHEN tags ? 'height'
THEN (SUBSTRING(tags ->> 'height' FROM '^[0-9]+'))::real
WHEN tags ? 'building:height'
THEN (tags ->> 'building:height')::real
WHEN tags ->> 'building:levels' ~ '^[0-9.]+$'
THEN (tags ->> 'building:levels')::real * 3
ELSE 6 END)) as tags,
geom
FROM osm_ways
WHERE (tags ? 'building' OR tags ? 'building:part') AND ((NOT tags ? 'layer') OR (tags ->> 'layer')::real >= 0)`,
},
{
minzoom: 13,
maxzoom: 20,
sql: `
SELECT
id,
tags
SELECT
id,
tags
|| jsonb_build_object('extrusion:base', (CASE
WHEN tags ? 'building:min_height'
THEN tags ->> 'building:min_height'
WHEN tags ->> 'building:min_level' ~ '^[0-9\\\\\\\\.]+$'
THEN tags ->> 'building:min_level'
ELSE '0' END)::real * 3)
WHEN tags ? 'building:min_height'
THEN (tags ->> 'building:min_height')::real
WHEN tags ->> 'building:min_level' ~ '^[0-9.]+$'
THEN (tags ->> 'building:min_level')::real * 3
ELSE 0 END))
|| jsonb_build_object('extrusion:height', (CASE
WHEN tags ? 'building:height'
THEN tags ->> 'building:height'
WHEN tags ->> 'building:levels' ~ '^[0-9\\\\\\\\.]+$'
THEN tags ->> 'building:levels'
ELSE '2' END)::real * 3) as tags,
geom
FROM osm_relations
WHERE tags ? 'building'`,
WHEN tags ? 'height'
THEN (SUBSTRING(tags ->> 'height' FROM '^[0-9]+'))::real
WHEN tags ? 'building:height'
THEN (tags ->> 'building:height')::real
WHEN tags ->> 'building:levels' ~ '^[0-9.]+$'
THEN (tags ->> 'building:levels')::real * 3
ELSE 6 END)) as tags,
geom
FROM osm_relations
WHERE (tags ? 'building' OR tags ? 'building:part') AND ((NOT tags ? 'layer') OR (tags ->> 'layer')::real >= 0)`,
},
],
}

0 comments on commit 5d0aaa7

Please sign in to comment.