Skip to content

Upgrade styles to expressions #775

Closed
Closed

Description

@1ec5

The Historic, Railway, Woodblock, and Japanese Scroll styles are all currently using the filter, function, and token syntaxes, which were deprecated in 2017 in favor of expressions. Expressions are required for many newer GL JS features that we’ll need to implement features such as language fallbacks and bilingual labels for #481. Expressions will also help us consolidate style layers, which will allow the tiler to consolidate the tileset’s layers as well, improving performance across the board.

A stylesheet can contain a mix of functions and expressions, but it’s a lot cleaner and less error-prone to migrate everything over to expressions at once. It looks like Maputnik has rudimentary, nonvisual support for editing expressions and converting functions to expressions: maplibre/maputnik#620 maplibre/maputnik#622. If we need a more visual expression editor, Fresco is one alternative. It uses Mapbox GL JS under the hood rather than MapLibre GL JS, though it would be possible to avoid incompatibilities by testing before deployment.


  • main/historic style
  • woodblock style
  • japanese scroll style
  • rail style

Activity

  1. erictheise commented on May 1, 2024

    @erictheise
    Contributor

    I've got a fair amount of experience coding/converting style expressions manually so keep me in mind as a resource on this issue.

  2. added a commit that references this issue on May 13, 2024
  3. moved this to In Progress in OHM Cartoon May 14, 2024
  4. jeffreyameyer commented on May 29, 2024

    @jeffreyameyer
    Member

    Any update or progress on this ticket? I'm feeling like we're getting closer to some multilingual labels (#481).

  5. danrademacher commented on Jun 11, 2024

    @danrademacher

    @erictheise could take a look at this commit OpenHistoricalMap/map-styles@2cfb70c and make any recommendations for next steps.

  6. danrademacher commented on Jun 12, 2024

    @danrademacher

    Looking at dependencies for #481, which is our priority here, @tsinn also needs to convert the text labels to expressions

  7. jeffreyameyer commented on Jun 25, 2024

    @jeffreyameyer
    Member

    Is there any sort of eta for this being completed, or how much progress has been made so far?

  8. 1ec5 commented on Jul 7, 2024

    @1ec5
    MemberAuthor

    Once this is complete, we’ll need to update all the time slider implementations to manipulate a filter based on an expression instead of a legacy function, as outlined in gramps-project/gramps-web#454 (comment). This would be a good opportunity to factor out a plugin for date filtering: #840.

  9. 2 remaining items

  10. vknoppkewetzel commented on Jul 25, 2024

    @vknoppkewetzel

    Updating this ticket - Last week, Tim wrapped up converting all functions to expressions

  11. jeffreyameyer commented on Jul 25, 2024

    @jeffreyameyer
    Member

    at our carto meeting, @vknoppkewetzel indicated this work is complete & @1ec5 reminded us that this should break the timeslider, which uses the older filters.

    So, it seems like the completion of this ticket bumps up the priority of this fix:
    #855 - updating timeslider to supporting expressions

    As well as the priority of these tickets supporting new features:
    #679 - All name keys in vtiles
    #854 - Providing the right name strings to the stylesheets for localization

    In addition, we should identify other possible performance improvements enabled by the expressions upgrade:

    • combining layers
    • embed improvements

    etc.

  12. moved this from In Progress to Done in OHM Cartoon Aug 2, 2024
  13. 1ec5 commented on Aug 4, 2024

    @1ec5
    MemberAuthor

    This work is not complete. As of OpenHistoricalMap/map-styles@1179bee, the style functions have been converted to expressions. However, every text-field property is still set to a string with the deprecated {token} syntax instead of a get expression. This blocks label localization.

    Additionally, as far as I can tell, no filter has been converted to use expressions yet. (It’s the conversion of filters that would need to be coordinated with a fix for #855.)

    Once all this work is complete, we can track combining style layers for better performance as a separate task.

  14. moved this from Done to In Progress in OHM Cartoon Aug 4, 2024
  15. vknoppkewetzel commented on Aug 5, 2024

    @vknoppkewetzel

    Thanks @1ec5 we will take a look at this and resolve those, thanks for catching

  16. added a commit that references this issue on Aug 7, 2024
  17. added a commit that references this issue on Oct 15, 2024
  18. 1ec5 commented on Nov 13, 2024

    @1ec5
    MemberAuthor

    MapLibre publishes a command line tool, gl-style-migrate, that automatically converts legacy filters, functions, and tokens to expressions.

  19. vknoppkewetzel commented on Nov 21, 2024

    @vknoppkewetzel

    🎉

  20. moved this from In Progress to Done in OHM Cartoon Nov 21, 2024
  21. added theissue type on Mar 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions