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 !): 

   

/// Routine from DeepEarth to display WMS as tile inside the Silverlight control 
/// 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/
 

6 Responses to “Overlay WMS on Google in Silverlight Bing”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.