Open wginsberg opened 7 months ago
Should we throw an error if no theme
is passed?
It could be more explicit if we had positional arguments. In the future, the lang
argument will also be required to specify en
, de
, etc.
Proposal welcome.
Just opened a PR where it just sets the theme to "light" by default. I think it is a little nicer than throwing an error (and maybe how this worked before? I was using an older version of this package and encountered this problem when I upgraded)
Thanks for the PR. I recall the issue here now, which is that if we pass this:
leafletLayer({paintRules:myPaintRules})
If I'm visualizing my own tileset, as of right now on main this sets labelRules to []
which makes sense. If we set a default theme it will make the labelRules
default to the light theme label rules, which is also confusing and implicit behavior.
So we probably need some breaking change in the API to encapsulate these use cases:
1) initialize the map with a default theme 2) initialize the map with one of the pre-baked 5 themes 3) initialize the map with a custom set of label rules / paint rules
Fair enough! will close my PR for now
What if we created a 2nd entry point called like leafletBasemapLayer("light", {"url":"...."})
to encapsulate this use case?
Also, would a Typedoc page like this: https://protomaps.github.io/PMTiles/typedoc/ be helpful?
The
theme
option for theleafletLayer
function is marked as optional, however when I omit nothing gets shown on the map.I.e.
I am keen to try to submit a PR to fix this one.