Dark Theme with Bing Maps #2054
-
A Bing maps tile source is currently created as follows: map.Layers.Add(new Mapsui.Tiling.Layers.TileLayer(
BruTile.Predefined.KnownTileSources.Create(
BruTile.Predefined.KnownTileSource.BingRoads,
"BingMapsKey"))); This works fine but is using only the light theme. Is it possible to configure this to switch between light and dark theme? According to this past issue Mapsui seems to just pull bitmap tiles from the server and can't change them. #647 This seems to be backed up here: https://gis.stackexchange.com/questions/14033/is-it-possible-to-access-the-bing-maps-dark-mode-in-the-arcgis-js-api. Where the method is simply post-processing the bitmaps. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I looked at bing maps online and came to the same conclusion as the answer in that stackoverflow answer. They fetch png tiles and use some color transformation to turn it into dark mode. Mapsui has no standard option for that. If something like that would be added I guess the parameters for that should be part of the RasterStyle (Or a class derived from RasterStyle) and those should be applied in the SkiaSharp renderer, which seems possible https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/effects/color-filters. Although this functionality is not standard in Mapsui it is possible to add it yourself using the 'custom style renderers'. This is what @taublast is using in his response. #647 (comment). That issue is originally about vector tiles where this could not be used, but it can for pngs. A small thing: The tiles bing uses for night mode are black and white and not colored like the ones returned by the BruTile.Predefined.KnownTileSource.BingRoads you mention, but BruTile can be configured to return another tile layer. If you do a color transformation it is easier to get nice results if you use a black and white image. |
Beta Was this translation helpful? Give feedback.
I looked at bing maps online and came to the same conclusion as the answer in that stackoverflow answer. They fetch png tiles and use some color transformation to turn it into dark mode. Mapsui has no standard option for that. If something like that would be added I guess the parameters for that should be part of the RasterStyle (Or a class derived from RasterStyle) and those should be applied in the SkiaSharp renderer, which seems possible https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/effects/color-filters.
Although this functionality is not standard in Mapsui it is possible to add it yourself using the 'custom style renderers'. This is what @t…