Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1735
XamMap may throw System.NotSupportedException when downloading OSM tiles from MapQuest
posted

Hi,

I've run into an issue that should be handled by the XamMap control. I'm using the XamMap control with OpenStreetMap tiles from MapQuest, but from time to time the control crashes with a System.NotSupportedException, thrown by the System.Windows.Media.Imaging.BitmapDecoder class in the Infragistics.Controls.Maps.XamMultiScaleImageView.DownloadClient_DownloadDataCompleted method. The exception message is ' No imaging component suitable to complete this operation was found.'.

The attatched zip-file contains a sample project XamMapException.csproj (in another zip-file) that can trigger the error. The zip-file also contains a screen dump of the VS2012 call-stack at the time of an exception (XamMapException.png) as well as a sample tile (60541.png) that looks to be causing the issue. The crash is most easily triggered by the sample application by zooming in to OSM zoom-levels 16-20 at e.g. Northern Africa, but I've experienced the crash at most other places as well from time to time.

After some debugging I think the cause of the error is due to the fact that the MapQuest OSM server do not necessarily return valid PNG-files for all tile requests. If I currently download e.g. the tile at the following url:
http://otile1.mqcdn.com/tiles/1.0.0/osm/17/66229/60541.png,
which is attched as  60541.png in the zip.file, I get a tile that does not contain a valid PNG image, but rather a string with the following text:
'The tile you requested is not available at the moment. Please try again later.'
The associated web response has a content type of 'text/plain' instead of e.g. 'image/jpg'.

The issue looks to be discussed at this MapQuest forum thread as well:
http://developer.mapquest.com/web/products/open/forums/-/message_boards/view_message/290730#_19_message_290306

Irrespective of the error cause, I think the XamMap control should catch any BitmapDecoder exceptions and not let them propagate to the user. The XamMap should just simply drop tiles that can't be decoded. There is no simple way for the user of the XamMap to handle these exceptions.

Regards,
Leif

 

 

 

 

 

 

 

MapQuest.zip
Parents Reply Children
No Data