Skip to main content

Shared building layers

Shared fill-extrusion buildings (08.14)

GeoJSON/MVT Polygon/MultiPolygon support fill-extrusion. Height/base are metres above the flat ground plane,default0,range0..100000;base must not exceed height. Color defaults black,opacity1,vertical-gradienttrue. Common attribute/state/zoom expressions provide numeric,color and boolean values. Metres are converted to display height at the polygon's latitude.

map.addLayer({id:'buildings',type:'fill-extrusion',source:'your-polygons',paint:{
 'fill-extrusion-height':['get','height'],
 'fill-extrusion-base':0,
 'fill-extrusion-color':'#ef4444',
 'fill-extrusion-opacity':1,
 'fill-extrusion-vertical-gradient':true
}});
map.setPitch(45);
await map.sqs.flush({render:true});

Common layer/source identity,filter/order,zoom,state and property updates are retained. Flat views show the roof footprint/courtyard holes. Perspective views use actual roofs,outer/courtyard walls and existing 3D lighting. The gradient multiplies bottom wall RGB by0.75 and preserves top color. Alpha/opacity combine once. Picking uses the same mesh,clips near/far depth and tests roof/wall projection. Hidden/transparent layers do not hit;depth occlusion between other layers is not additionally promised.

Each geometry is limited to500K vertices/1.5M indices,visible rendering retains the scene index budget,and queries inspect at most500K triangles. Mercator latitude is limited to±85.051129. Invalid height pairs/candidate budgets reject before updates. Terrain buildings are connected. Globe,sloped foundations,patterns/translate and other standard properties remain pending;unsupported properties reject explicitly. MVT geometry clipping and stable-ID query deduplication are connected; stroke pixel ownership and geometry merging remain pending. Consumers provide UI. Thecomplete HTMLcontains all button handlers.