Is API possible to auto cache tiledmapservice ?

4118
1
Jump to solution
01-14-2015 07:54 PM
ItthisakPhueaksri
New Contributor

Hi.

I would like to cache of tiledmapservice but I don't want to export tiled or use local tile.

Can it auto cache when I pan or zoom map?

0 Kudos
1 Solution

Accepted Solutions
Nicholas-Furness
Esri Regular Contributor

You could create a custom tiled layer which contains an instance of the runtime's layers, and cache tiles as they're returned by the contained instance, before you pass them back to the AGSMapView. This repository‌ does a similar thing, but it applies a Core Image Filter to each tile before passing it on rather than caching it.

However, you would need to carefully consider how to handle cache cleanup and constraint. What do you eject from the cache when memory constraints start getting hit: Least used? Oldest in cache? Furthest from current extent? Furthest from current zoom? Do you eject groups of tiles at once, or individual tiles - you probably want to consider contiguous areas. Doubtless the best solution would be some combination of all of those.

Note: Even if you came up with a good caching strategy, to do this against one of the Esri provided basemap layers would, unfortunately, currently be against the licensing terms.

View solution in original post

0 Kudos
1 Reply
Nicholas-Furness
Esri Regular Contributor

You could create a custom tiled layer which contains an instance of the runtime's layers, and cache tiles as they're returned by the contained instance, before you pass them back to the AGSMapView. This repository‌ does a similar thing, but it applies a Core Image Filter to each tile before passing it on rather than caching it.

However, you would need to carefully consider how to handle cache cleanup and constraint. What do you eject from the cache when memory constraints start getting hit: Least used? Oldest in cache? Furthest from current extent? Furthest from current zoom? Do you eject groups of tiles at once, or individual tiles - you probably want to consider contiguous areas. Doubtless the best solution would be some combination of all of those.

Note: Even if you came up with a good caching strategy, to do this against one of the Esri provided basemap layers would, unfortunately, currently be against the licensing terms.

0 Kudos