maplibre-style-spec icon indicating copy to clipboard operation
maplibre-style-spec copied to clipboard

Allow data-driven styling for line-dasharray

Open lucaswoj opened this issue 7 months ago • 2 comments

⚠️ Must be merged BEFORE https://github.com/maplibre/maplibre-gl-js/pull/5812.

This PR updates the style specification and validation logic to allow the line-dasharray property to be data-driven, as part of resolving https://github.com/maplibre/maplibre-gl-js/issues/1235.

Example usage:

"paint": {
  "line-dasharray": [
    "case",
    ["==", ["get", "road_type"], "trail"], ["literal", [1, 1]],
    ["==", ["get", "road_type"], "highway"], ["literal", [4, 2]],
    ["literal", [2, 2]]
  ]
}

Launch Checklist

  • [x] Set property-type of line-dasharray to cross-faded-data-driven
  • [ ] Fix test failures
  • [ ] Set js version in data-driven styling
  • [ ] Update docs to explain that, in practice, line-dasharray only works with literal expressions
  • [x] Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • [x] Briefly describe the changes in this PR.
  • [x] Link to related issues.
  • [ ] Include before/after visuals or gifs if this PR includes visual changes.
  • [ ] Write tests for all new functionality.
  • [ ] Document any changes to public APIs.
  • [ ] Post benchmark scores.
  • [ ] Add an entry to CHANGELOG.md under the ## main section.

lucaswoj avatar Apr 25 '25 22:04 lucaswoj

Was this closed by mistake?

HarelM avatar May 07 '25 05:05 HarelM

Looks like it was auto-closed because I changed the branch name. Will fix!

lucaswoj avatar May 07 '25 18:05 lucaswoj

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 95.33%. Comparing base (8dc8c06) to head (0131e0a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1100   +/-   ##
=======================================
  Coverage   95.33%   95.33%           
=======================================
  Files         114      114           
  Lines        7401     7401           
  Branches     2245     2245           
=======================================
  Hits         7056     7056           
  Misses        345      345           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov-commenter avatar Jun 25 '25 23:06 codecov-commenter

@lucaswoj , thanks for the work on this so far! I'm working on something that depends on this fix, so just wondering if you have a rough idea of when it might be released?

hbrooks-dsit avatar Jul 15 '25 08:07 hbrooks-dsit

Thank you! I’m going to put in another block of work on the PR next week. It should then be ready to move into code review. After that, the timeline is largely out of my hands. Hopefully the maintainers are motivated to review, merge, and release this feature! 

lucaswoj avatar Jul 17 '25 04:07 lucaswoj

Woohoo! All render tests on https://github.com/maplibre/maplibre-gl-js/pull/5812 are now passing. I think there are a few edge cases that are broken but untested. However this is a big step closer to marking this "ready for review."

lucaswoj avatar Jul 27 '25 00:07 lucaswoj

Thanks for all your hard work on this project! I’m also interested in this feature, as the commenter above mentioned. Is there anything blocking the merge that we could help with? I’m not very experienced in this area, but happy to assist if possible.

humutkazan avatar Aug 18 '25 08:08 humutkazan

@lucaswoj , how far is this PR? is it ready for review, or are there missing pieces to the validation logic still?

birkskyum avatar Sep 24 '25 15:09 birkskyum

@lucaswoj , how far is this PR? is it ready for review, or are there missing pieces to the validation logic still?

This PR is ready for review

lucaswoj avatar Sep 24 '25 15:09 lucaswoj

This looks great! thanks! I'll merge this and release a new version just after https://github.com/maplibre/maplibre-gl-js/pull/5812 is approved to avoid creating an "invalid" maplibre-gl-js version.

HarelM avatar Sep 25 '25 19:09 HarelM