-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Support of Mapbox Style Specification out-of-the-box #121
Comments
Most likely I'm going to remove Fonts work by loading normal web (woff2) fonts as shown here: https://protomaps.github.io/protomaps-leaflet/examples/fonts.html#2/0.0/0.0 There isn't any sprite support yet, but it can be accomplished by writing a custom Symbolizer and sampling a sprite atlas loaded into a canvas element. |
Thanks for your answer @bdon, so what you suggest is that we create our own module to support this if we'd like to as it will be shortly removed from this module ? By the way, based on your experience/knowledge do you know what parts of the spec specifically need to be enhanced or added ? In case of missing features is it only at the style parsing level or because current rules/symbolizers cannot support it ? |
Yes, I'd suggest building your own module for this or making a package that can be installed separately for reading MapLibre JSON and generating Symbolizers. You don't have to rely on only the Symbolizers defined in this project (and it would be more flexible to write your own). I'd guess <20% of the spec is implemented, and only the easy parts; the difficult parts are anything related to fonts and dynamic label layout. |
I guess that supporting OpenMapTiles-like styles is not a high step w.r.t. supporting the whole standard. Indeed, I made some adjustements and it already gives a better result: https://drive.google.com/file/d/1s6VK7EWdgepwuDSBRXohon1dnRG_p6zP/view. Here are the details:
For now font management only relies on the default font as I did not take time to try to load new fonts. For sure sprite support needs to be considered. However I think that two simple things could make result far more better:
Any help is welcome, notable code pointers to where to insert better support or fix issues. I have probably noticed some issues to be confirmed:
|
Nice work!
Yes, right now it will always be off by 1 zoom level, you can change the parameter
can you link to an example of this? it may depend on invalid geometry in the tileset you're using |
I will try to use About supporting background color could you point me in the right direction in the code as not taking it into account currently breaks the whole color rendering. Thanks. |
the backgroundColor is implemented as part of the leaflet frontend and not the JSON style right now, since there should only ever be one of these a workaround may be to ignore the JSON style and use this: https://github.com/protomaps/protomaps-leaflet/blob/main/src/frontends/leaflet.ts#L206 |
* Remove compat/json_style for MapLibre JSON styling * Remove extra basemap styles * Remove color shading feature of default style * Remove user interaction, inspect and x-ray features See CHANGELOG for explanations and alternatives.
#129 is an overview of the many feature removals planned for 2.0. It should still be possible to use the json style as a module as part of your own code. |
* Remove compat/json_style for MapLibre JSON styling * Remove extra basemap styles * Remove color shading feature of default style * Remove user interaction, inspect and x-ray features See CHANGELOG for explanations and alternatives.
* Remove features prior to major version 2.0, make parameter names consistent case. [#112, #121, #71, 55] * Remove compat/json_style for MapLibre JSON styling * Remove extra basemap styles * Remove color shading feature of default style * Remove user interaction, inspect and x-ray features See CHANGELOG for explanations and alternatives. * update CHANGELOG with 2.0 feature removal details [#122] * Unify naming conventions [#112] * change all internal and external-facing property and variable names to camelCase instead of snake_case.
This has been removed from |
Just for information we started this, it's a work in progress but in any case anyone want to help you are welcome. |
Hi and thanks for the awesome work done by protomaps.
We are coming from a background where we use PlaneTiler to generate MBTiles based on a OpenMaptiles profile then visualize it using TileServer GL with custom MapBox Styles derived from OpenMapTiles styles.
We would be happy to now use PMTiles but as we rely on Leaflet and not MapLibre a work has to be done to convert our styles from Mapbox Style Specification to protomaps-leaflet rules/symbolizers. Indeed, as far as we can see in the documentation, there is no out-of-the-box support for this.
However, we discovered what seems to be an undocumented function named
json_style
in the source code that seems to exactly do what we'd like to. So far we tried to use this function on one of our style and it gave some encouraging results as you can see in this video. However, we have been required to fix the style a little bit so that parsing went fine. Moreover, some colors do not seem to be correctly taken into account (e.g. waterway, background), we have to investigate to understand why. Last but not least, we are stucked with fonts and sprites as we don't really know how to handle it.As a consequence, we wonder if someone in the community could give us some insights about the style conversion function, notably how fonts/sprites are expected to work. Also does this feature be relevent to be hardened, enhanced, documented ? We would be glad to help and make some PRs if required.
The text was updated successfully, but these errors were encountered: