greensopinion / flutter-vector-map-tiles

A plugin for `flutter_map` that enables the use of vector tiles.
BSD 3-Clause "New" or "Revised" License
139 stars 70 forks source link

[StyleReader] add support for field "tiles" in sources. #166

Open T-moz opened 1 year ago

T-moz commented 1 year ago

According to various map styles specification, the sources properties can ether hold a field url or a field tiles.

Currently tiles is not supported. The StyleReader. _readProviderByName makes the assomption that url is not null, but in the spec, url is not required.

greensopinion commented 1 year ago

Why do you need it? How would you use it?

Henk-Keijzer commented 11 months ago

I need it! This is the first part of the json file I need to use:

{ "version": 8, "name": "Xyz (local)", "metadata": { "mapbox:type": "template" }, "sources": { "openmaptiles": { "type": "vector", "attribution": "(c) xyz", "scheme": "xyz", "tiles": [ "https://services.xyz.nl/api/map/nl/{z}/{x}/{y}" ], "minzoom": 0, "maxzoom": 14 } }, "sprite": "https://services.xyz.nl/sprite", "glyphs": "https://services.xyz.nl/api/fonts/nl/{fontstack}/{range}", "layers": [ { "id": "basemap-background", "type": "background", "minzoom": 0, "paint": { "background-color": "rgba(245, 249, 236, 1)" } }, { "id": "basemap-park", "type": "fill",

This style file is according to the mapbox specs defined here: https://docs.mapbox.com/style-spec/reference/sources/

greensopinion commented 10 months ago

I've just merged a change that might do what you want: https://github.com/greensopinion/flutter-vector-map-tiles/blame/main/lib/src/style/style.dart#L108C7-L116

Feel free to provide feedback on this issue, and close it if it's working for you now.