This is a migrated thread and some comments may be shown as answers.

Where does RadMap cache tiles?

4 Answers 213 Views
Map
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 07 Apr 2015, 08:23 PM

We've added the RadMap control to our WPF application.  I have a custom tile provider that interfaces with a home-grown tile service.  Tee provider basically makes HTTP calls to a custom URL in order to retrieve tiles.  This provider does no caching of its own.

However, a tester here had map data for the US only, then uninstalled that map data and installed map data for Peru.  When they went back into our application, they were able to see roads on Long Island, which they shouldn't have seen.  For this reason, we believe that the RadMap control itself is caching tiles.

Does RadMap cache tiles?  If so, where is this cache and how can we empty it?

 Here is the code for the custom tile provider.  As you can see, there's no code for caching in here at all.

 

public class SelexTileSource : TiledMapSource {
 
    public string BaseURL { get; set; }
 
    public SelexTileSource() : base( 1, 20, 256, 256 ) { }
 
    public override void Initialize() {
        this.RaiseIntializeCompleted();
    }
 
    protected override Uri GetTile( int tileLevel, int tilePositionX, int tilePositionY ) {
        int zoomLevel = ConvertTileToZoomLevel( tileLevel );
 
        string url = string.Format( BaseURL,
                                    zoomLevel.ToString( CultureInfo.InvariantCulture ),
                                    tilePositionX.ToString( CultureInfo.InvariantCulture ),
                                    tilePositionY.ToString( CultureInfo.InvariantCulture ) );
        return new Uri( url );
    }
}
 
public class SelexMapProvider : TiledProvider {
 
    public TiledMapSource Source {
        get { return iSource; }
        set {
            if ( iSource != null && MapSources.ContainsKey( iSource.UniqueId ) )
                MapSources.Remove( iSource.UniqueId );
            iSource = value;
            MapSources.Add( iSource.UniqueId, iSource );
        }
    }
    private TiledMapSource iSource;
 
    public override ISpatialReference SpatialReference {
        get { return new MercatorProjection(); }
    }
}

4 Answers, 1 is accepted

Sort by
0
Tony
Top achievements
Rank 1
answered on 09 Apr 2015, 03:22 PM

I've found the answer to my own question.

If you do not set the MapProvider's IsTileCachingEnabled to true, tiles are not cached at all.  If you do set it to true, tiles get cached in

%USERPROFILE%\AppData\Local\TelerikMapCache\<Map Provider Class Name>

 So in my case, they're cached in C:\Users\tony.vitabile\AppData\Local\TelerikMapCache\SelexMapProvider.

0
Petar Marchev
Telerik team
answered on 10 Apr 2015, 11:05 AM
Hello Tony,

The tile provider has a public CacheStorage property which you can set when necessary. By default the tile provider uses a file-system-cache and caches the tiles in the file system in the app-data folder in the sub folder you indicated.

Regards,
Petar Marchev
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Pete
Top achievements
Rank 1
answered on 04 Oct 2016, 09:52 AM

I noticed that even if I disable caching on the tile provider and then disconnect from the network, some tile data would still be displayed. It seems that map data is also stored in the Internet Explorer browser cache - is that correct?

Thanks

Pete

0
Petar Mladenov
Telerik team
answered on 07 Oct 2016, 07:02 AM
Hi Pete,

You mentioned InternetExplorer, does it mean you use RadMap for Silverlight ? In Silverlight, the RadMap internally uses MultiScaleImage class which has its own caching turned on by default (check its CacheMode which is inherited from UIElement). I don't think the IE manages the caching folders and caching options.
Please check out this post regarding Clearing the Silverlight Cache.

Regards,
Petar Mladenov
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
Map
Asked by
Tony
Top achievements
Rank 1
Answers by
Tony
Top achievements
Rank 1
Petar Marchev
Telerik team
Pete
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or