ThinkGeo.com    |     Documentation    |     Premium Support

OpenStreets Tile Cache

Hi,

I am experimenting with OpenStreetsMapLayer and notice like GoogleMapLayer that there are settings for TileCache, but unlike GoogleMapLayer, there is no constructor to add a directory to store the cache.

I am wondering if it is possible to set a local directory for the cache to be generated just as in GoogleMapLayer constructor?

Regards,
Damian

Hi Damian,

If you want to set cache for OpenStreetMapLayer please set it like this:

OpenStreetMapLayer osm = new OpenStreetMapLayer();
osm.TileCache = new FileBitmapTileCache(“folder”, “id”);

The Google, Bing and OSM is special layers, so their constructor should be different.

Regards,

Ethan

Thanks Ethan. This works good.

Why does WMSRasterLayer not have this option?

Regards,
Damian

Hi Damian,

The WMSRasterLayer is universal class, it should be set the cache in overlay level.

Regards,

Ethan

Hi Ethan,

That works, but I am trying to understand why some layers have tile cache and some are through overlay only. What are the usage guidelines?

Also, I am concerned that if I have more than just the WMS in an overlay that the tile cache will not honor if some of the layer’s visible property is changed or the shape is altogether removed. Won’t those layers still show up in the cached results?

Regards,
Damian

Hi Damian,

You can think the GoogleMapsLayer, BingMapsLayer and OpenStreetMapLayer to be 3rd part web-based layer, it only have limited number different style types, and the request format is known. So we cannot do more changes for the sent parameter about them.

But the WMSRasterLayer is dynamic, it’s only to be a standard, we cannot know which “layer” is used by user, and we cannot know whether the server have some special parameter to control its style, so we don’t set cache in layer level, only leave the overlay level cache, user need to handle the cache by themselves.

And in fact for Google, Bing & OSM, they have two level cache, layer level and overlay level. It’s for improve the performance, but generally we still suggest close layer level cache and use overlay level cache.

And if your layer get changed, the cache won’t get changed unless you force it update. So if you have one overlay which contains Google map (cached) and other layer, you can close overlay level cache. But if you are using wms layer, and you want to do that, you should put it to a separate overlay.

Regards,

Ethan