mapbox / mapbox/mapbox-gl-js

"building_id" property will show fill-extrusion layer with wrong heights

Open
#13,712 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

3.28.1

### Browser and version

151.0.7922.77

### Expected behavior

feature property `building_id` does not have any influence of any rendering when it is not used in style.
So a `fill-extrusion` layer together with a terrain will be rendered as normal also if features has `building_id` as a string property.

Image

### Actual behavior

Will show `fill-extrusion` layers with strange heights at tile borders when using it together with terrain. Height will be correct when i delete my property `building_id`, which is an string uuid.

Image

looks like `building_id`is used internally and needs to be an number, otherwise breaks.
https://github.com/mapbox/mapbox-gl-js/blob/v3.28.1/src/data/bucket/fill_extrusion_bucket.ts#L1080
```
if (feature.properties && Object.hasOwn(feature.properties, 'building_id')) {
centroid.buildingId = Number(feature.properties['building_id']);
}
```

might be that it can be fixed by
- also check if its an number
- allow string
- make the property key configable

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 in src/data/bucket/fill_extrusion_bucket.ts around line 1080, then reproduce a terrain fill-extrusion layer using a string-valued building_id property. Trace how that property affects centroid building IDs and verify the fix by confirming unused string properties no longer produce incorrect heights at tile borders.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.