Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
linze99 opened this issue Sep 29, 2024 · 1 comment
Labels

Comments

@linze99
Copy link

linze99 commented Sep 29, 2024

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

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

@stepankuzmin
Copy link
Contributor

This looks like a bug, thanks for creating an issue, @linze99.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants