josxha / flutter-maplibre

Unofficial MapLibre bindings for Flutter
https://flutter-maplibre.pages.dev
Other
2 stars 1 forks source link

[FEATURE] Introduce SVG symbol source support #38

Open gabbopalma opened 1 week ago

gabbopalma commented 1 week ago

Feature Description

Currently SVG images are not supported for Symbol sources. I found that this integration was planned by MapLibre in its roadmap, but I don't actually know if it is supported in the native repositories for Android and iOS. If parsing this format is already supported by the natives, the integration in Flutter would be a big plus.

Describe alternatives you've considered

An alternative is to recognize the image format and then parse the SVGs as well, converting them to a PNG format. I think this can be avoided, but it can be a solution.

Additional context

https://maplibre.org/roadmap/svg-symbol-source/ https://github.com/maplibre/maplibre/issues/271

josxha commented 6 days ago

SVG support for MapLibre is currently listed under the "Under Consideration" section. MapLibre on Android for example expects a Bitmap to it's pretty save to say it's currently not supported. (: However, there is still some opportunity that would indirectly add support for SVGs as well. It would be amazing if it users would be possible to use widgets as symbols on the map. It is possible to rasterize a rendered widget to an image and pass it to the MapLIbre SDK. This will probably have a slight delay until the rasterized widget gets displayed on the MapLibre map but it could be acceptable for a lot of users when they can use a simple widget tree to design their symbols. A small example on how to turn a widget tree into an png image can be seen here: https://github.com/josxha/flutter-maplibre/blob/test/widget-to-png/example/lib/callbacks_page.dart