Hi @Leo_Liu,
Below is part of a function in which the aerial photo is set as a wmsrasterlayer.
I enclosed also the sub which turns on the cache.
I hope this code helps you to solve this.
Regars,
Guido van den Boom
Dim PDOK As New WmsRasterLayer
With PDOK
.Uri = New Uri("https://service.pdok.nl/hwh/luchtfotorgb/wms/v1_0?&request=GetCapabilities&service=wms?")
.Crs = "EPSG:3857"
.ActiveLayerNames.Add("PDOK_2023")
.Name = "2023_orthoHR"
End With
MapBackgroundPDOKOverlay.Layers.Add(PDOK)
MapBackgroundPDOKOverlay.CacheOn
Public Sub CacheOn(ByVal OverlayToChache As Overlay)
If TypeOf (OverlayToChache) Is WmsOverlay OrElse TypeOf (OverlayToChache) Is LayerOverlay OrElse TypeOf (OverlayToChache) Is WmtsTiledOverlay Then
Dim OverlayObject As Object = OverlayToChache
Try
If IsNothing(OverlayObject.Name) Then OverlayObject.Name = Guid.NewGuid.ToString
OverlayObject.TileCache = New FileRasterTileCache(CacheDirectory, OverlayObject.Name, RasterTileFormat.Png)
Catch ex As Exception
End Try
End If
End Sub