protomaps / basemaps

Basemap PMTiles generation and cartographic styles for OpenStreetMap data and more
https://maps.protomaps.com/
Other
372 stars 47 forks source link

Compatability with @americana/maplibre-shield-generator #159

Open neodescis opened 1 year ago

neodescis commented 1 year ago

Description It seems that presently only the US interstates have a network of anything besides "other." It would be great if the tile set produced could be compatible with @americana/maplibre-shield-generator. That project has a very extensive mapping of networks to road shields, and it would be great if we could somehow leverage it with these tiles/styles.

bdon commented 1 year ago

@neodescis is there a well-defined specification of the possible values and how those map to shields?

We would target the shield icons at the bottom of https://www.nextzen.org

A goal of these styles is to work the same across web and native, which would exclude using SVG fallbacks.

neodescis commented 1 year ago

The mapping is built dynamically, and as far as I can tell it is not (yet?) published in an npm package. I've inquired about this. However, their current mapping is published here: https://zelonewolf.github.io/openstreetmap-americana/shields.json

The shield generator library is not tightly coupled to that mapping, but leveraging it seems valuable.

Many (most?) of the shields are generated on the fly with draw functions, but some are handled with empty sprite images as well. Those sprites are generated from SVG, but supplied to MapLibre as a .png file at runtime. It's a pretty interesting solution to the shield problem.

bdon commented 1 year ago

Thanks. We definitely want to address shields and route concurrencies, this will likely happen sometime in 2024 as we enhance the tileset before the styles.

neodescis commented 1 year ago

Sounds great. Do you have a roadmap published anywhere? I am presently using the tileset to drive part of my own set of map styles, and this is the one place I've found the tile data to be lacking. Depending on the timing, I may even be able to lend a hand.

nvkelso commented 1 year ago

+1 for more complicated shield data values! There's 2500 lines of shield logic over in Tilezen we can port over – looking at network values, ref values, and coarse reverse geocoding the country.

@bdon the blocker here is being able to coarse reverse geocode the country code.

bdon commented 1 year ago

the blocker here is being able to coarse reverse geocode the country code.

implicit dependency on https://github.com/protomaps/basemaps/issues/44

bdon commented 2 weeks ago

@nvkelso it looks like shield_text_length can be eliminated in favor of https://maplibre.org/maplibre-style-spec/expressions/#length ?

Currently thinking of leaving ref straight from OSM and populating shield_text with maximum 5 characters, along with network. then shield_text2 and network2 for concurrencies, up to some fixed number.

nvkelso commented 2 weeks ago

Works for me!

Tilezen didn't have the length for a very long time until it was needed for backwards compatibility with older versions of the predecessor to MapLibre, would be nice to remove it.