xamarin.formsarcgisarcgis-runtime-net

Cache tiles for offline use with ArcGis .net


App made in xamarin forms currently using MapsUI I am looking into ArcGis now. Most things are very easy to set up, but I have not been able to find examples of making my own tile provider that can cache tiles for later offline use.

The user needs to select a rectangle on a map and download that region to some limited resolution level. When later using the app, and trying to fetch a certain tile, I can see if the tile is available in cache and provide that.

From what I am seeing, it seems that you can go online in a browser and create offline tile sets that you can use, but I need it to be more dynamic and through the app on the phone.


Solution

  • See the section on taking ArcGIS Online services offline: https://developers.arcgis.com/net/offline-maps-scenes-and-data/ In particular: https://developers.arcgis.com/net/offline-maps-scenes-and-data/download-an-offline-map-on-demand/

    Also note that tile caching does occur on the device using standard http client caching. By default it's 100mb on Android and Windows (on iOS cache is managed by the NSUrlSession).

    You could implement your own ImageTiledLayer and handle image loading yourself, (https://developers.arcgis.com/net/api-reference/api/net/Esri.ArcGISRuntime/Esri.ArcGISRuntime.Mapping.ImageTiledLayer.html) but just beware of any terms of use around wrt caching data as most data providers have pretty strict rules for/against that.