TileLayer in Layers collection

Apr 26, 2011 at 8:37 PM

I am using SL4.

We have a few tile sources that supports translucency. This tiles needs to be able to be displayed over some layers which are not tiled. By slightly modifying TileSource.GetTileLayers method we were able to add a tile layer to the map Layers collection and sets its source to our tile source. This basically works but there is two problems.

1- Our tile source is displayed both in the tile layer added to Layers collection and in the BaseLayer. When the Opacity of the tile layer in Layers collection is changed to zero, we observed that those layers behind it become visible but the tiles in BaseLayer is also visible below those.

2- As tiles are visible in both BaseLayer and in tile layer added to Layers (see 1 above), we observe that the zoom level in these two are different. The tiles in the tile layer added to Layers is in a higher zoom level so the text are not readable.


I hope I could explain the problems accurately and someone can fine a solution.


May 6, 2011 at 3:47 PM

We could solve the first problem by modifying the TileSource's GetTileLayers method. We commented off everything and left the following lines (We don't use Overlay)

        protected override void GetTileLayers(int tileLevel, int tilePositionX, int tilePositionY, IList<object> tileSources)
            if (IsValidTileLevel(tileLevel))
                tileSources.Add(GetTile(tileLevel, tilePositionX, tilePositionY));



The 2nd problem still exists. If we use the same tile source for BaseLayer and a TileLayer added to the Map's Layers collection, the tile layer requested for the 2nd one is one higher than the first one. For example, if in some zoom level the highest tile layer requested for BaseLayer's TileSource is 23, the highest for the Tilelayer added to Layers is 24. The tiles are displayed correctly in the exact same position but the text for the 2nd one is not readable because the a higher tile layer is displayed. MSI viewport origin and width are the same for both layers.

What information MSI uses to calculate the tile layer to request? What else can we check?

I appreciate if someone can help.