Hi,
I'm evaluating the XamMap class and currently I'm looking into how to use this control with a local tile cache for use with OpenStreetMap. I e.g. want downloaded tiles to be cached and reused if they have been cached within the last 30 days.
As far as I can see I can use a subclass of MapTileSource as an extension point. However, this only provides the XamMap with a tile URL. I need to get access (callback?) to the tile data when the tile for the provided URL has been downloaded, so that I can save the tile to disk. What are my options here ?
Regards,Leif
Leif,
Yes, the custom tile source lets you change the url's provided, but, at the moment you can't extend the portion of the multi scale image that would allow you to redirect at a cache. There are other options as to how to achieve this though. You could use a local web proxy that cached the tiles, and make sure that the urls generated would be fed through the proxy, for one. Or, alternatively, you could register a scheme handler for your application and make sure that the uri's provided by the tile source use this custom scheme. That handler could check for the uri in local storage before firing off the actual request if the file isn't cached yet.
I haven't tried this approach for the tile imagery before, but here is a link were I am using a custom scheme to load shape files from isolated storage for the Silverlight version of the map: http://es.infragistics.com/community/forums/p/39754/224934.aspx#224934
The principle should be the same, let us know if you have any issues applying that approach.
-Graham
Graham,
introducing a web proxy seems a bit too 'complicated' for simply caching tiles. I don't like the idea of adding such a service only for this purpose. I'm using the most recent version of XamMap though (2012.2), so that should mean that I can try out the scheme handler approach. I'll test it one of the next days, and post back to this thread with my results.
EDIT: I've now quickly tested the scheme handler approach and it looks like this is something I can use.