Select to view content in your preferred language

overlay a WMS layer on top of Bingmap Tilelayer

1457
9
01-09-2011 11:18 PM
SolidSmoke
Emerging Contributor
i'm using ArcGIS api for silverlight ver 2.1 and i have an application in which i have kept bingmap as base layer. I need to show WMS layer on top of that. if i use wms layer, it will not show up. Please advise me what might be the problem.

Thanks in advance
0 Kudos
9 Replies
DanielWalton
Frequent Contributor
Most likely the WMS does not support Bing's spatial reference (WKID 102100). If you have Fiddler or Firebug, watch the HTTP requests and see what the WMS's response to the GetCapabilities query says. It will return an XML document that contains listings of layers, supported spatial references, etc.

Example: http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?%20&service=WMS&request=GetCapabilities&...

In the response, inside <Service><Capability><Layer>, you will see the following supported spatial references:

<CRS>EPSG:4326</CRS>
<CRS>EPSG:900913</CRS>
<CRS>EPSG:102100</CRS>
<CRS>EPSG:3857</CRS>

Another gotcha is that you often need to supply a proxy to the WMS class, since Silverlight cannot download from servers without a clientaccesspolicy.xml or crossdomain.xml file at the server's root.
0 Kudos
dotMorten_esri
Esri Notable Contributor
Your WMS service must support EPSG:3857 for this to work with any WebMercator projection. This is a fairly recent addition to the EPSG list, so older WMS servers might not support it.
0 Kudos
SolidSmoke
Emerging Contributor
if wms service does not support EPSG:3857, do we have any method to convert that like 4326 to 3857 in the runtime and show it on top of the bing map tile layer.
0 Kudos
dotMorten_esri
Esri Notable Contributor
No. The client api cannot reproject rasters on the fly.
0 Kudos
karenvolarich
Occasional Contributor
You might not need to reproject.  I too am using the Bing Maps as a base layer.  The key was the skipgetcapabilities="true"

<esri:WmsLayer ID="Nexrad"
                           Url="http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?" Version="1.1.1" Layers="nexrad_base_reflect" SkipGetCapabilities="True" Initialized="WmsLayer_Initialized" Visible="False"/>
0 Kudos
DarkoRadiceski
Emerging Contributor
I seem to be having a similar problem. I have a bing maps base map. On top of that i would like to display a wms layer from a meteorological data provider.

However it seems that this wms layer does not support EPSG:3857.

From testing in the FLEX viewer it appears that EPSG:4283 specified for the same WMS layer will give good enough results. Not exact match but good enough.

Is it possible to force a CRS attribute for the WMS layer to be used in the Silverlight application instead of it inheriting the SpatialReference value from the base map of EPSG:3857.

Any advice?
0 Kudos
DanielWalton
Frequent Contributor
It won't be pretty, but it can be done. You'll have to download the source code for the ESRI Silverlight toolkit and modify the WmsLayer.GetUrl() method. The default logic is to replace Google and Bing projection WKIDs with the official EPSG 3857 in the SRS query string parameter. You'll probably want to comment out that logic if your weather service is 102113 (like NWS).
0 Kudos
DarkoRadiceski
Emerging Contributor
Thank you kindly for that. I did try that and now i can overwrite the CRS attribute to the value of interest.

However now there seems to be an issue with the BBOX parameter.

It gets writtens as: bbox=11309038.8451793,-3623643.66581829,18891592.0510688,-742273.447580295

instead of:
BBOX=-56.7621825020225,72.0160274699255,5.26827435076945,242.929733053682

The change in the source code not to set 3857 is ok.

Do i need to do some re projection of the parameters too?
0 Kudos
DanielWalton
Frequent Contributor
Not sure, try converting to decimal degrees and switching Easting/Northings. WMS is messy IMO.
0 Kudos