How to set the opacity of Tile Sources in Nokia Maps for WP8?
Asked Answered
S

1

11

I want to take advantage of some of the new features of the Windows Phone 8 Nokia Maps API (Microsoft.Phone.Maps.Controls namespace).

I have a sequence of TileSource classes, each with a different image. I play the images back in a loop on the map.

In Windows Phone 7, I would create several Microsoft.Phone.Controls.Maps.MapTileLayer classes, add a TileSource to each one, and add them to the map. Then, I would use a timer to go through the layers, setting the opacity of the current one to 1 and the opacities of the others to 0.

enter image description here

In Windows Phone 8, there is no MapTileLayer class. I can add all of the TileSource classes to the Map.TileSources collection, but I cannot change their opacities.

If I add only one source at a time, for each frame adding the current source and removing the last, there is considerable flicker, so this method will not work

Is there a class similar to WP7's MapTileLayer or Bing Maps AJAX's TileLayer in WP8 or some other way to change the opacities of Tile Sources?

Spence answered 7/12, 2013 at 4:1 Comment(6)
I'm not able to try this but something like this could work: (map.Layers[0][0].Content as UIElement).Opacity = 1; to get the first layer's first overlay and set the Content's opcaity ... (map.Layers[1][0].Content as UIElement).Opacity = 1; to get the second layer's etc...Gilmer
Thanks for the suggestion, but the map.Layers collection has nothing in it, even after I have added the tile sources and waited until they loaded.Spence
Windows Phone 8 does not use the Bing Maps API. That is for Windows Phone 7. For Windows Phone 8 a new control/experience was created that uses Nokias maps rather than Bing. You can still use the old Bing Maps control in a WP8 application by adding the reference to it directly. Using the old maps control might be easierHotze
Have you tried using System.Windows.Media.Brush class and set the opacity of the brush used ? msdn.microsoft.com/en-us/library/windowsphone/develop/…Marquesan
True, I worded this question wrong, changing it to Nokia Maps. Also I have found the old version to be somewhat slower it lacks the dark maps mode.Spence
Either nobody wants 250 reputation or this is just not possible. Would be too bad if that's so...Spence
H
1

This just isn't possible with the current API. I have looked into this from a number of different angles over the past year. There isn't an out of the box solution for this. However, there is one potential work around which works but requires some work and likely isn't ideal. You can store the tiles on a server and set the opacity through a service. Basically do something like this: http://rbrundritt.wordpress.com/2009/11/27/bing-maps-custom-tile-skinner/ but change the opacity.

Hagen answered 23/1, 2014 at 11:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.