[AppStudio for ArcGIS] Disable cache on a WebTiledLayer

1201
10
07-16-2019 07:01 AM
JorgeFrade_Martínez
New Contributor III

When i perform a zoom if i dont have tiles for that area, the upper level tiles was shown instead of disappear...

How i can disable that feature?

Tags (2)
0 Kudos
10 Replies
ErwinSoekianto
Esri Regular Contributor

Jorge, 

I don't see any property or method to disable cache on the WebTiledLayer documentation of ArcGIS Runtime SDK for Qt/QML.

I am including ArcGIS Runtime SDK for Qt‌ to see anyone in this group know the answer to this. 

Thank you,

Erwin

0 Kudos
LucasDanzinger
Esri Frequent Contributor

I don't have good data to test if this works or not, but can you try setting the noDataTileBehavior property (inherited from ImageTiledLayer) to Enums.NoDataTileBehaviorBlankhttps://developers.arcgis.com/qt/latest/qml/api-reference/enums-nodatatilebehavior.html

0 Kudos
JorgeFrade_Martínez
New Contributor III

Lucas Danzinger I have the same behavior with every one of the enum options.

There you have a good data to test it. (attached)

A greeting!

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Can you share your code please?

0 Kudos
JorgeFrade_Martínez
New Contributor III
WebTiledLayer{
   visible: map.layerVisibilityOfflineTopoFire;
   templateUrl: AppFramework.userHomeFolder.filePath("ArcGIS/AppStudio/Data/MyMarvelousApp/") + "/topofire/{level}/{col}/{row}.jpg;
   noDataTileBehavior: Enums.NoDataTileBehaviorBlank;
}
0 Kudos
LucasDanzinger
Esri Frequent Contributor

Hi Jorge-

It seems like the no data behavior is not working on WebTiledLayer. This seems like a bug. As a workaround, could you try implementing a custom basemap with ServiceImageTiledLayer instead? It is more code but very customizable and works as you describe your requirements:

// add a mapView component
MapView {
    anchors.fill: parent
    // set focus to enable keyboard navigation
    focus: true

    // add a map to the mapview
    Map {
        Basemap {
            id: basemapOSM

            ServiceImageTiledLayer {
                noDataTileBehavior: Enums.NoDataTileBehaviorBlank

                fullExtent: Envelope {
                    spatialReference: SpatialReference { wkid: 3857 }
                    xMin: -20037508.342789244
                    xMax: 20037285.703807656
                    yMin: -20037471.205137063
                    yMax: 20037471.205137063
                }

                tileInfo: declaredTileInfo

                // use callback function to request tiles
                tileUrlCallback: function(level, row, col) {
                    var requestUrl = "/Users/luca6804/Downloads/topofire/topofire/" + level +"/" + col + "/" + row + ".jpg";
                    return requestUrl;
                }
            }
        }
    }
}


TileInfo {
    id: declaredTileInfo
    dpi: 96
    format: Enums.TileImageFormatPNG
    origin: Point {
        spatialReference:  SpatialReference { wkid: 3857 }
        x: -20037508.342789244
        y: 20037508.368847027
    }
    spatialReference: SpatialReference { wkid: 3857 }
    tileHeight: 256
    tileWidth: 256

    LevelOfDetail {
        level: 0
        scale: 591657527.591555
        resolution: 56543.03392800014
    }
    LevelOfDetail {
        level: 1
        scale: 295828763.795777
        resolution: 78271.51696399994
    }
    LevelOfDetail {
        level: 2
        scale: 147914381.897889
        resolution: 39135.75848200009
    }
    LevelOfDetail {
        level: 3
        scale: 73957190.948944
        resolution: 19567.87924099992
    }
    LevelOfDetail {
        level: 4
        scale: 36978595.474472
        resolution: 9783.93962049996
    }
    LevelOfDetail {
        level: 5
        scale: 18489297.737236
        resolution: 4891.96981024998
    }
    LevelOfDetail {
        level: 6
        scale: 9244648.868618
        resolution: 2445.98490512499
    }
    LevelOfDetail {
        level: 7
        scale: 4622324.434309
        resolution: 1222.992452562495
    }
    LevelOfDetail {
        level: 8
        scale: 2311162.217155
        resolution: 611.4962262813797
    }
    LevelOfDetail {
        level: 9
        scale: 1155581.108577
        resolution: 305.74811314055756
    }
    LevelOfDetail {
        level: 10
        scale: 577790.554289
        resolution: 152.87405657041106
    }
    LevelOfDetail {
        level: 11
        scale: 288895.277144
        resolution: 76.43702828507324
    }
    LevelOfDetail {
        level: 12
        scale: 144447.638572
        resolution: 38.21851414253662
    }
    LevelOfDetail {
        level: 13
        scale: 72223.819286
        resolution: 19.10925707126831
    }
    LevelOfDetail {
        level: 14
        scale: 36111.909643
        resolution: 9.554628535634155
    }
    LevelOfDetail {
        level: 15
        scale: 18055.954822
        resolution: 4.77731426794937
    }
    LevelOfDetail {
        level: 16
        scale: 9027.977411
        resolution: 2.388657133974685
    }
    LevelOfDetail {
        level: 17
        scale: 4513.988705
        resolution: 1.1943285668550503
    }
    LevelOfDetail {
        level: 18
        scale: 2256.994353
        resolution: 0.5971642835598172
    }
    LevelOfDetail {
        level: 19
        scale: 1128.497175
        resolution: 0.2985821417799086
    }
}
JorgeFrade_Martínez
New Contributor III

Can you try this on a SceneView?
It seems that this dosent work at all, at least for me.

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Looks like the tiles show up, but the no data behavior property isn't respected in 3D - only 2D. 

0 Kudos
JorgeFrade_Martínez
New Contributor III

So... There is no solution? 😞

0 Kudos