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

Publish GL JS plugin for time filtering #840

Closed
1ec5 opened this issue Jul 6, 2024 · 3 comments
Closed

Publish GL JS plugin for time filtering #840

1ec5 opened this issue Jul 6, 2024 · 3 comments

Comments

@1ec5
Copy link
Member

1ec5 commented Jul 6, 2024

The timeslider library is fine if you already have a Leaflet map set up and want a full-blown UI, but a developer might be using a Mapbox/MapLibre GL JS map directly or they might only need the filtering capability without an interactive slider UI. Perhaps they want to supply their own UI with a distinctive design, or they only want to show a particular date noninteractively.

We should publish an NPM library that only contains the runtime styling code for manipulating the stylesheet’s filters using runtime styling. There are already many reimplentations of this code that could benefit from consolidation, such as:

None of these implementations follows the Leaflet timeslider plugin’s date filtering implementation, which is too complicated to use as an example: #562.

For #651, we’ll need to reimplement the timeslider to eliminate its Leaflet dependency. This would be a good opportunity to have the Leaflet timeslider plugin depend on a consolidated library.

As soon as we convert the stylesheets to use expressions (#775), we’ll need to update each of these implementations to manipulate expressions instead of legacy function-based filters, as outlined in gramps-project/gramps-web#454 (comment). We might as well migrate them to this new library at the same time. The library could support either syntax for broad compatibility.

@1ec5
Copy link
Member Author

1ec5 commented Jul 13, 2024

For any style layer that’s already written as an expression, we should probably use the start_date and end_date properties instead of start_decdate and end_decdate, respectively. This would eliminate any possible discrepancies between the existing PL/pgSQL implementation and the simpler JavaScript implementation that I advocated for in #562 and implemented several times above.

The existing implementations all key off the decimal date fields because MapLibre’s legacy filter syntax can only compare strings verbatim. With expressions, we can parse the strings and compare them lexicographically. This not only avoids any floating point precision error but also potentially opens the door to intraday filtering, once the tiles expose the contents of start_date:edtf=* and end_date:edtf=* tags: #15 (comment).

@1ec5
Copy link
Member Author

1ec5 commented Aug 4, 2024

I started maplibre-gl-dates by extracting the relevant bits of OpenHistoricalMap/openhistoricalmap-embed@e3a45aa.

@1ec5 1ec5 added the dates label Aug 4, 2024
@1ec5 1ec5 moved this from Todo - Known Path to Ready for staging in OpenHistoricalMap Dev Planning Aug 6, 2024
@1ec5
Copy link
Member Author

1ec5 commented Aug 9, 2024

The maplibre-gl-dates plugin should be in decent shape now. I’ve deployed it to all the sites mentioned above, except for Gramps Web, which is awaiting review: gramps-project/gramps-web#479. Meanwhile, #855 tracks upgrading leaflet-ohm-timeslider-v2. Any remaining work on the plugin or its adoption can be tracked in separate tickets.

@1ec5 1ec5 closed this as completed Aug 9, 2024
@github-project-automation github-project-automation bot moved this from Ready for staging to Done in OpenHistoricalMap Dev Planning Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

1 participant