Overlay WMS on Google in Silverlight Bing
This post talked about the way how to enable WMS over the Google in OpenLayers (or other Spherical Mercators) maps – http://blog.sumbera.com/2010/02/17/overlay-wms-on-google-in-openlayers/ and this post about overlying tiled WMS over the new Google Map v3 (http://blog.sumbera.com/2010/11/02/tiled-wms-overlay-on-google-map-v3/ )
This post is about testing this inside the Silverlight Bing map control.
The quick preview is available here :
http://www.sumbera.com:80/lab/silverlight/SilverlightApplication3TestPage.aspx
and below is the main routine that calls WMS request from Silverlight (thanks to DeepEarth open source project !):
/// http://deepearth.codeplex.com/sourcecontrol/changeset/view/37324?projectName=deepearth#583728
/// modified to work in Bing map control
public override Uri GetUri(int tilePositionX, int tilePositionY, int tileLevel) {
int zoom = tileLevel; //SSU tileLevel would be same as zoom in Bing control
string quadKey = TileXYToQuadKey(tilePositionX, tilePositionY, zoom);// Use the quadkey to determine a bounding box for the requested tile
BBox boundingBox = QuadKeyToBBox(quadKey);
double deltaX = 0.00135; //SSU deltaX for SLP WMS
double deltaY = 0.00058; //SSU deltaY for SLP WMS
// Get the lat longs of the corners of the box
double lon = XToLongitudeAtZoom(boundingBox.x * TILE_SIZE, 18) + deltaX;
double lat = YToLatitudeAtZoom(boundingBox.y * TILE_SIZE, 18) + deltaY;
double lon2 = XToLongitudeAtZoom((boundingBox.x + boundingBox.width) * TILE_SIZE, 18) + deltaX;
double lat2 = YToLatitudeAtZoom((boundingBox.y – boundingBox.height) * TILE_SIZE, 18) + deltaY;
string wmsUrl = string.Format(this.UriFormat, lon, lat, lon2, lat2, TILE_SIZE);
return new Uri(wmsUrl);
Update 10/2010: above routine is limited only to 18 zoom levels,please check the new routine for calculating BBOX in silverlight Bing here http://blog.sumbera.com/2010/11/07/tiled-wms-overlay-in-windows-phone-7/
Advertisement
Categories: Code, WMS
Bing, Silverlight, tiled WMS overlay


I cant get the overlay to show, the Google tiles and everything else displays fine but i dont get any WMS overlay…?
There is some bug in Silverlight (or Bing map control) that doesn’t for some reason display WMS overlays in other platfroms than Windows. So if you run Mac, Linux you won’t see WMS overlay. On Windows you should see it regardless of the broswer used. S.
Hmm…but im using WinXP, IE8 and Silverlight(3.0.40818.0), but no WMS overlay? Am i supposed to do something to make it work?