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

Allow for line-gradient usage together with line-dasharray #5082

Open
Michal-Sw-airspace-intelligence opened this issue Nov 20, 2024 · 3 comments
Labels
enhancement New feature or request PR is more than welcomed Extra attention is needed

Comments

@Michal-Sw-airspace-intelligence
Copy link

Michal-Sw-airspace-intelligence commented Nov 20, 2024

As suggested by: #1235 (comment)

I don't think that would be the scope of this issue. I have multiple ideas in mind regarding lines like performance and other things. As of now, this implementation will not inherently allow gradients specifically for line-dash. If you need to apply gradients to dashed lines, additional work or a separate feature implementation might be necessary to support that functionality.

If gradient support for dashed lines is important for your project, I recommend opening a new issue or feature request after the implementation of data-driven for line-dash to discuss it further with the community.

User Story

As a developer, I can use line-gradient together with line-dasharray to style lines with both gradients and dashed patterns, so that I can create visually complex and appealing line styles in my application.

Rationale

Why is this feature needed?

Combining line-gradient with line-dasharray enables developers to create more intricate and visually engaging designs, such as gradient-colored dashed lines that can enhance the appearance of maps or visualizations.

Example use cases:

  • Visualizing a route with a gradient that diverges at a certain point, using a dashed pattern to indicate that it represents an alternative path to the same destination.
  • Representing dynamic data like network traffic where color gradients show intensity, and dashes denote sections with interruptions.

Can it be done today? Is there a workaround?

  • Currently, this combination is not possible, forcing developers to choose between using gradients or dashed patterns. Workarounds, such as overlaying two separate lines, are complex, inefficient, and often visually unsatisfactory.

Impact

What if we do nothing?

Developers will continue to face limitations in line styling

Example:

    paint: {
      'line-width': ['get', width],
      'line-gradient': [
        'interpolate',
        ['exponential', 2],
        ['line-progress'],
        0,
        'rgba(255, 41, 41, 1)',
        0.15,
        'rgba(255, 173, 173, 1)',
        0.85,
        'rgba(0, 44, 133, 1)',
        1,
        'rgba(0, 85, 255, 1)',
      ],
      'line-dasharray': [0.1, 1.4],
    },

Image

@HarelM
Copy link
Collaborator

HarelM commented Nov 20, 2024

Can you add a visual example of how this would look along with a style definition (mockup)?

@HarelM HarelM added enhancement New feature or request PR is more than welcomed Extra attention is needed labels Nov 20, 2024
@Michal-Sw-airspace-intelligence
Copy link
Author

Can you add a visual example of how this would look along with a style definition (mockup)?

Sure, added into the description

@JacobArrow
Copy link

Not that it matters much, but Mapbox already has this feature, and I really hope we can get it in Maplibre aswell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PR is more than welcomed Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants