mapbox / mapbox/mapbox-gl-js

How can I make the lines I draw in 3D more clear?

Open
#13,482 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs information :pray:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

![Image](https://github.com/user-attachments/assets/8e431e5b-aeb6-42f8-9ad1-2fa43d720e57)
![Image](https://github.com/user-attachments/assets/44b5512a-9511-444b-8b08-e62cdda0a478)

The first picture is the trajectory I drew in 3D perspective. Because of the large altitude difference, the lines are not clear. The code is as follows:

```
map.setTerrain({ 'source': 'mapbox-dem', 'exaggeration': 1 });

map.addSource("trace", {
type: "geojson",
lineMetrics: true,
data: (data as any).data,
});

map.addLayer({
type: 'line',
source: 'trace',
id: 'line',
paint: {
'line-color': 'yellow',
'line-width': 6,
},
layout: {
'line-cap': 'round',
'line-join': 'round',
'line-z-offset': 20
}
}):
```

How can we achieve the effect shown in Figure 2?

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 provided map.setTerrain, addSource, and addLayer configuration and reproduce the difference between the two figures. Inspect how terrain rendering and 3D line layers handle altitude, depth, and line visibility. Done means identifying a supported configuration or a clearly scoped implementation path that produces the clearer result.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.