Skip to content

Conversation

@chuhlomin
Copy link

Adds support for using line-progress expressions in line-offset to create variable line offsets that change along a line's length.

This enables use cases like subway/transit maps with lines that merge and diverge.

Note: Most of this implementation was generated with assistance from Claude Sonnet 4.5. This is a feature I've wanted for a side project for about 2 years, and I couldn't have completed it without AI assistance.

Fixes #12729, #10374

Implementation

  • Shader changes: Added VARIABLE_LINE_OFFSET define and extended vertex attribute usage
  • Bucket evaluation: Added evaluation of variable offset values alongside existing variable width support
  • Feature interaction: Properly handles cases where both VARIABLE_LINE_WIDTH and VARIABLE_LINE_OFFSET are active
  • Style spec: Updated line-progress documentation to include line-offset property

The performance impact should be negligible for typical use cases.

Example Usage

paint: {
  'line-offset': [
    'interpolate',
    ['linear'],
    ['line-progress'],
    0, -10,  // Start offset
    1, 10    // End offset
  ]
}

Demo

See debug/variable-line-offset-demo.html for a working example showing a line with offset varying from -10px to +10px along its length.

Screenshot 2026-01-01 at 13 22 43

@mapbox/map-design-team, @mapbox/static-apis this PR includes style spec API
@mapbox/gl-native this PR includes shader changes

@CLAassistant
Copy link

CLAassistant commented Jan 2, 2026

CLA assistant check
All committers have signed the CLA.

@chuhlomin chuhlomin marked this pull request as ready for review January 2, 2026 13:53
@chuhlomin chuhlomin requested a review from a team as a code owner January 2, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support line-progress for line-offset property

3 participants