-
Notifications
You must be signed in to change notification settings - Fork 1
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
Updates to timeslider and demo for Maplibre 3.6.2 #15
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is shippable, though we might want to streamline the expressions a bit to eke out any available performance gains in what’ll end up being a hot code path.
// warning: we are mutating someone else's map style in-place, and they may not be expecting that | ||
// if they go and apply their own filters later, it could get weird | ||
const osmfilteringclause = [ 'any', ['>', '1', '0'] ]; | ||
const osmfilteringclause = ["==", "nodatefilter", ["literal", "nodatefilter"]]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the idea that a style designer can opt a layer out of date filtering by wrapping its filter in this expression? If so, perhaps we should instead rely on some special property in the layer’s metadata
that we can document.
[ | ||
'any', | ||
['!', ['has', 'start_decdate']], | ||
['<=', ['to-number', ['get', 'start_decdate'], -Infinity], ['literal', deccurrent]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can tell, OHM vector tiles always set start_decdate
and end_decdate
to numbers, not strings, so the to-number
expression is unnecessary. If we intend this code to apply to third-party tilesets too, then some additional type safety would be reasonable, but we could just as well document a requirement for these fields to be numbers.
[ | ||
'any', | ||
['!', ['has', 'end_decdate']], | ||
['>=', ['to-number', ['get', 'end_decdate'], Infinity], ['literal', deccurrent]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can tell, deccurrent
is guaranteed to be a number, so there’s no need to wrap it in a literal
expression. We only need to wrap arrays and objects in literal
expressions.
Refer to OpenHistoricalMap/issues#855
match
statements which were giving errors, with==
orin
statements, and also addedliteral
where arrays were being passed as argumentsliteral