mapbox / mapbox/mapbox-gl-js

3D buildings are still visible over the raster layer in the standard style

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

Currently, I am using standard style from Mapbox (mapbox://styles/mapbox/standard) to show 3D building. When I add the raster (image) layer to the map, it should be overlap the 3D building and only display the image. It works well in high level zoom. but when I zoom the map in, some edges of 3D building are still visible and overlap the image.

Image

mapbox-gl-js version: 3.12.0

browser: Chrome (Version 136.0.7103.114 (Official Build) (arm64)

Steps to Trigger Behavior
// add raster layer into map
if (!map.getSource('metro')) {
    map.addSource('metro', {
      tileSize: 256,
      tiles: [<raster-url>],
      type: 'raster'
    })
  }
  if (!map.getLayer('metro')) {
    map.addLayer(
      {
        id: 'metro',
        slot: 'top',
        source: 'metro',
        type: 'raster'
      },
      getFirstDrawLayer(map)?.id
    )
  }
Demonstration

https://drive.google.com/file/d/1Mj25w0zlqvwfFsUjqyPgWfnQEv4rZuIT/view?usp=sharing

https://codesandbox.io/p/sandbox/mutable-thunder-j2kych

Expected Behavior

Raster layer should on top of the 3D building, and no edges of object are shown

Actual Behavior

Some edges of 3D object are shown and flicking

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 CodeSandbox reproduction and inspect the map.addSource and map.addLayer calls for the raster layer, especially its top slot and insertion position. Reproduce the issue at different zoom levels in Chrome and compare the rendered ordering. Done means the raster layer fully covers the 3D buildings without visible edges or flickering.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.