Update 13/03/2013, here is new blog about Tiled WMS overlay for Windows Phone 8 :https://blog.sumbera.com/2013/03/10/tiled-wms-overlay-in-windows-phone-8/
This post [https://blog.sumbera.com/2010/02/25/overlay-wms-on- google-in-silverlight-bing/ ] talked about how to overlay over the Bing maps Silverlight control Google tiles and tiled WMS. It was quite easy to port this web sample into the Windows Phone 7 emulator. I took a smaple code from Training kit called “Ex1-TheBingMapControl” and extend it with the 2 classes : GoogleTile and WmsTile, with slight changes to the namespace using Microsoft.Phone.Controls.Maps (original for Silverlight was Microsoft.Maps.MapControl). Then extend MainPage.XAML with :
<my:MapTileLayer Opacity=”1″> <my:MapTileLayer.TileSources> <local:GoogleTile></local:GoogleTile> </my:MapTileLayer.TileSources> </my:MapTileLayer> <my:MapTileLayer Opacity=”1″> <my:MapTileLayer.TileSources> <local:WMSTiledOverlay></local:WMSTiledOverlay> </my:MapTileLayer.TileSources> </my:MapTileLayer>Extended sample code availabel for download here : http://www.sumbera.com/lab/wp7/TheBingMapControlWithWMSandGoogle.zip
Update: I found the way calculating BoundingBox from the quadkey somehow limiting (the DeepEarth weay) since it worked only till the level 18. So here is updated class fro getting correct bounding box of the tiled WMS request in the Bing Silverlight control:
: base(@”http://mapserver-slp.mendelu.cz/cgi-bin/mapserv?map=/var/local/slp/krtinyWMS.map&REQUEST=GetMap&SERVICE=wms&VERSION=1.1.1&SRS=EPSG:4326&WIDTH={4}&HEIGHT={4}&FORMAT=image/png&BBOX={0},{1},{2},{3}&LAYERS=hm2003&Transparent=true“){}
return (float)((tile_x / Math.Pow(2.0, zoom) * 360.0) – 180.0);
}
public static double TileToWorldPosY( double tile_y, int zoom) {
double n = Math.PI – ((2.0 * Math.PI * tile_y) / Math.Pow(2.0, zoom));
return (float)(180.0 / Math.PI * Math.Atan(Math.Sinh(n)));
}
public override Uri GetUri(int tilePositionX, int tilePositionY, int tileLevel) {
double deltaX = 0;// 0.00135; //SSU deltaX for SLP WMS
double deltaY = 0;// 0.00058; //SSU deltaY for SLP WMS
double minXLon = TileToWorldPosX(tilePositionX, zoom) + deltaX;
double minYLat = TileToWorldPosY(tilePositionY + 1, zoom) + deltaY;
double maxXLon = TileToWorldPosX(tilePositionX + 1, zoom) + deltaX;
double maxYLat = TileToWorldPosY(tilePositionY, zoom) + deltaY;
string wmsUrl = string.Format(this.UriFormat, minXLon, minYLat, maxXLon, maxYLat, 256);
return new Uri(wmsUrl);
}}
Pingback: Overlay WMS on Google in Silverlight Bing « Geospatial Haiku
Pingback: Tiled WMS overlay in Windows Phone 8 | Geospatial Haiku