mapbox / mapbox/mapbox-gl-js

clip layer stops removing a Mapbox Standard building in v3.18 that it removed in v3.12 (now rendered as fill-extrusion instead of model)

Open
#13,726 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :lady_beetle:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

### mapbox-gl-js version

Regression in v3.18.1 (please confirm still present on latest). Works correctly in v3.12.0.

### Browser and version

Chrome 141 / macOS 15

### Expected behavior

All 3D buildings inside the clip polygon are removed - as happens in v3.12.0, and as
described in Mapbox's own "clip layer to remove features" guidance for Standard.

### Actual behavior

In v3.18.1 one specific building (by KANAALWEG) is NOT removed, while every neighbouring
building inside the same polygon is. It disappears with
setConfigProperty('basemap','show3dObjects',false), confirming it is Standard basemap 3D -
but the clip layer (model/symbol) does not remove it. This indicates the building is now
rendered as fill-extrusion/building rather than model (as it was in v3.12.0), and
clip-layer-types only accepts 'model'|'symbol' (confirmed: the runtime hard-rejects
'fill-extrusion'/'building'), so there is no way to clip it.

Possible resolutions: (1) correct the data so this building renders as a model like its
neighbours, and/or (2) allow clip-layer-types to target fill-extrusion/building.


clip does not remove one Standard building (v3.18+)


html,body,#map{margin:0;height:100%}



// Change the two v3.18.1 URLs above to v3.12.0 -> the building IS removed.
mapboxgl.accessToken = 'YOUR_PUBLIC_TOKEN';
const map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/standard',
center: [5.108830543530047, 52.075147667677925],
zoom: 17.5, pitch: 60, bearing: -60
});
map.on('style.load', () => {
map.addSource('eraser', { type: 'geojson', data: {
type: 'FeatureCollection',
features: [{ type: 'Feature', properties: {}, geometry: { type: 'Polygon', coordinates: [[
[5.1093218547098616,52.0761552550843],[5.10832289035406,52.07655209212518],
[5.105983851861879,52.07623013026759],[5.105654924574253,52.0761253049759],
[5.105484369683467,52.075885703384444],[5.10758714812971,52.06753626674788],
[5.108025717847141,52.06718428376382],[5.108403375103677,52.06707194818483],
[5.110852056024726,52.067296619060215],[5.111461180632006,52.06785080238643],
[5.1093218547098616,52.0761552550843]
]]}}]
}});
map.addLayer({ id: 'eraser', type: 'clip', source: 'eraser',
layout: { 'clip-layer-types': ['model','symbol'] } });
});

### Link to the demonstration

https://codepen.io/baczkowskij/pen/PwpbWxB

### Steps to trigger the unexpected behavior

1. Load Mapbox Standard (mapbox://styles/mapbox/standard), centered on the Utrecht
Merwedekanaal depot ~[5.1088, 52.0751], pitch 60, zoom ~17.5.
2. Add a `clip` layer with `clip-layer-types: ['model','symbol']` over a polygon
covering the depot site (see demo).
3. Observe the 3D buildings inside the polygon.
4. Load the exact same style + clip in mapbox-gl-js v3.12.0, then in v3.18.1, and compare.

### Relevant log output

```shell

```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodePen reproduction and compare the same Standard style and clip layer in mapbox-gl-js v3.12.0 and v3.18.1. Inspect the clip layer's handling of model and symbol types alongside the Standard building rendering described in the report. Done means the Utrecht building is removed by the clip polygon on the latest version, or the remaining limitation is documented with a confirmed resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
computer-graphics, frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.