Refresh RapMap Provider

4 posts, 0 answers
  1. Etienne
    Etienne avatar
    47 posts
    Member since:
    Sep 2014

    Posted 13 May Link to this post

    Hello,

    I’ve had issue with RadMap Provider cache in my application. My RadMap is connected to a local WMS (Geoserver). I've changed the map on the Geoserver to hide airport locations but it's not displayed in my RadMap (see attachments).

    I have set the attribute "IsTileCachingEnabled = true" to enable tile caching (under %APPDATA%/Local/TelerikMapCache).
    Then I added a function to clear the MapProvider when requested by the user :

                if (_mapProviderWrapper.MapProvider is WmsCustomProvider)
                {
                    var wmsCustomProvider = (WmsCustomProvider)_mapProviderWrapper.MapProvider;
                    var cacheStorage = wmsCustomProvider.CacheStorage as FileSystemCache;
                    if (cacheStorage != null)
                    {
                        string cachePath = cacheStorage.CachePath;
                        Directory.Delete(cachePath, true);
                        Directory.CreateDirectory(cachePath);
                    }
                }

    But even when the folder is empty and that I restart the application, RadMap still display airports which may means that tiles are cached somewhere else.
    Is there a way to force a refresh of a MapProvider after the cache has been cleared?

    Thanks!

    Etienne

  2. Martin
    Admin
    Martin avatar
    1099 posts

    Posted 16 May Link to this post

    Hello Etienne,

    Thank you for contacting us.

    The cached tiles are saved in the AppData folder as you mentioned in your post. The approach which you are using with deleting the folder should clear the cached tiles.
    string profile = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
    string cachePath = profile + "\\TelerikMapCache";
    Directory.Delete(cachePath, true);
    In addition you can try setting the provider's RequestCacheLevel property and set it to NoCacheNoStore. You can also check the other cache level options from the enumeration.

    If this doesn't help you can prepare a small project that isolates the described behavior and send it via new support thread. 

    Regards,
    Martin
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Etienne
    Etienne avatar
    47 posts
    Member since:
    Sep 2014

    Posted 16 May in reply to Martin Link to this post

    Hello Martin,

    Thanks for your quick reply. It works if "RequestCacheLevel" is set to "NoCacheNoStore", but I would like to keep the local cache because my GeoServer is not always available.

    It would be hard for me to provide you a small sample project as I would have to provide you my Geoserver and the procedure to apply modifications to demonstrate the issues that I am encountering.

    I'm having a hard time to figure out where the MapProvider gets his tiled cache :
     1- I have set the RequestCacheLevel to CacheIfAvailable. 
     2- When I clear the cache (via my application), the folder AppData/Local/TelerikMapCache/WmsCustomProvider/ gets cleared.
     3- I observe that the RadMap is reloading.
     4- Then new files appears in the AppData/Local/TelerikMapCache/WmsCustomProvider/ folder.
     5- RadMap still display the old version of the map which is problematic.

    Is there another cache somewhere that I am not aware of?

    Thank you,

    Etienne

  5. Martin
    Admin
    Martin avatar
    1099 posts

    Posted 19 May Link to this post

    Hi Etienne,

    RadMap is caching its tiles only in a single location. However, if you are experiencing this behavior only at runtime it is possible the tiles to be still cached in the memory. In this case you can try to reset the CacheStorage property of the provider. Or call the Load() method of the FileSystemChache object (the value of the CacheStorage property) and get the newly stored tiles.

    Please try those approaches and let me know if they work for you.

    Regards,
    Martin
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top