mapbox / mapbox/mapbox-gl-js

mapbox-gl raise some excptions when using data-driven paint property ["get", "height"] with "symbol-z-offset"

Open
#13,293 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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.7.0

**browser**:Chrome

### Steps to Trigger Behavior

1.Add a symbol layer
2.setting paint property: "symbol-z-offset": ["get", "height"],(with height property in properties)
3.zoom in an out

[https://codepen.io/Ze-Lin-the-encoder/pen/ZEPZwNo?editors=1111](url)

```js
mapboxgl.accessToken = "your token";

const data = {
type: "FeatureCollection",
features: [
{
geometry: {
coordinates: [-74.01495191750769, 40.706305039438774],
type: "Point"
},
type: "Feature",
properties: { name: "test point1", height: 8 }
},
{
geometry: {
coordinates: [-74.01443955717765, 40.70647273530287],
type: "Point"
},
type: "Feature",
properties: { name: "test point2", height: 5 }
}
]
};

const map = new mapboxgl.Map({
container: "map",
projection: "globe",
zoom: 18,
center: [-74.013575, 40.706069],
pitch: 57,
bearing: 27
});
map.on("style.load", () => {
map.addSource("test_labels", {
type: "geojson",
data: data
});
map.addLayer({
id: "test_labels",
type: "symbol",
source: "test_labels",
layout: {
"text-field": "{name}",
"text-size": 15
},
paint: {
"symbol-z-offset": ["get", "height"],
"symbol-elevation-reference": "ground",
"text-color": "#000000"
}
});
console.log(map.getStyle());
});

```

https://jsbin.com/

### Expected Behavior
截屏2024-09-29 22 16 59

### Actual Behavior
When zoom in or out, mapbox-gl raise some exceptions,then the symbox dispeared
截屏2024-09-29 22 17 07

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 using mapbox-gl-js 3.7.0, then zoom the globe map with the symbol layer and inspect the exceptions. Trace the handling of the data-driven "symbol-z-offset" expression and verify that symbols remain visible without exceptions while zooming.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.