Select to view content in your preferred language

Print problem with bing map layers

408
1
07-19-2011 01:03 PM
RajeshLingamarla
New Contributor
Hi,

I have a requirement to export the map control with all layers in it as an image. When i simply try to convert the map control to byte stream using WritableBitmap i get the error 'WriteableBitmap has protected content.Pixel access is not allowed' which is a siliverlight limitation as all online map services (ESRI/Bing) are outside the domain. So, I used the approach in the following code sample http://www.arcgis.com/home/item.html?id=b9d4f443461d41849b99c3f144ef1e65 to create the image outside silverlight in a wcf service. The sample works perfect for all ESRI tiled, dynamic and graphic layers. All dynamic layers and graphic layers that are internal to domain are sent as images (using layer.ToBitmap()) to WCF service and ESRI online layer images are retrieved directly from WCF service using WebClient.DownloadData. These layers are all combined to a single image in the WCF service. Now the problem is with bing map layers. I can not use layer.ToBitmap() for bing layers and i dont know of a way to get bing map tiles from a url using WebClient.DownloadData with extent sent as input.

My question is how to get bing map layer image/byte[] in WCF service by sending the map extent the way ESRI layer data is retreived in the above example?
0 Kudos
1 Reply
NiemTang
Emerging Contributor
Here is link to Bing REST API : http://msdn.microsoft.com/en-us/library/ff701724.aspx. You can use WebClient to get the bing image. However, I ran into another problem  that I haven't be able to figure out how to solve it: the returned bing image is off in term of extent and resolution even though I sent that same extent to Bing and to ESRI online services. So the combined imaged looks off. Maybe you will have better luck figure this one out.
0 Kudos