ThinkGeo.com    |     Documentation    |     Premium Support

Automatic Caching from WMS Server

Hello,

I’m working on a project where I am connecting to a WMS server to display a map. I have the map displaying correctly, and it creates the cache whenever the tile is displayed:

cacheOverlay = new WmsOverlay();
cacheOverlay.TileCache = new FileRasterTileCache(@“C:\Documents\WmsMapCache”, “cacheId”);
cacheOverlay.ServerUri = new Uri(“https://basemap.nationalmap.gov/arcgis/services/USGSTNMBlank/MapServer/WMSServer”);

I would like to be able to click a button and generate the cache across the world, so I have access to the cache without having to slowly, manually pan over the globe.

Thanks!

Hey @Betsy_Richardson,

You can certainly do that (assuming the WMS server allows you to do that and doesn’t blacklist you for crawling their maps). Unfortunately, we don’t have a built-in feature for this, but you can build it yourself with our APIs. If you look at our HowDoI samples, there’s a BasicNavigationSample that shows you how you can zoom and pan on the map programmatically:

Sample Code:

HowDoI Sample Project:

So, what you can do is have a button that starts the crawl at a given zoom level and extent (perhaps of the whole world?). Then pan the map to the right by 100%. You can then use the MapView’s OverlaysDrawn event handler to continue the crawl to the right until the map’s extent is outside of your target extent. In which case, you would pan the map down 100% and begin panning left. You just continue this zig zag motion until the map is completely outside the target extent. From there, you tell the map to zoom in at the top right corner of your target extent and let the application do it all over again until the map is completely crawled.

Thanks,
Kyle