Home > Code, WMS > Overlay WMS on Google in Silverlight Bing

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/
 
Advertisement
Categories: Code, WMS Tags: , ,
  1. Richard
    March 24, 2010 at 8:10 am | #1

    I cant get the overlay to show, the Google tiles and everything else displays fine but i dont get any WMS overlay…?

    • March 24, 2010 at 12:21 pm | #2

      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.

      • Richard
        March 24, 2010 at 12:32 pm | #3

        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?

  1. November 2, 2010 at 9:05 am | #1
  2. November 2, 2010 at 9:12 am | #2
  3. November 7, 2010 at 9:33 pm | #3

Leave a Reply

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

Gravatar
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.