When I create an ArcGISLocalTiledLayer and point it at the path to a tile package (.tpk) the MinScale and MaxScale properties are by default set to NaN.
Here's why that is a problem, if the layer is the first one added to the map the map uses the MinScale and MaxScale of the tiles in that layer to restrict zooming of the map from then on. If I then replace that tile package layer with another one with a different set of tiles at different scales the map will not zoom to them. If I could find out what the MinScale and MaxScale of the tile package was I'd be able to change the map MinScale and MaxScale when the new layer was loaded.
The values are in the tile package in the mapservice.json file but I haven't found a way to read those values using the .Net SDK.
Hi Stefan,
To get the scales of the different levels of a tile package you could use Tilecache class. Below is the code that gives you the scale for each level:
TileCache tileCache = new TileCache(<location_of_tpk_file>);
await tileCache.LoadAsync();
if(tileCache.LoadStatus == LoadStatus.Loaded)
Console.WriteLine(tileCache.TileInfo.LevelsOfDetail);
var lods = tileCache.TileInfo.LevelsOfDetail.ToList();
foreach(LevelOfDetail lod in lods)
{
Console.WriteLine("LOD Scale: " + lod.Scale);
Console.WriteLine("LOD Level: " + lod.Level);
}
The scale exactly matches with the mapserver.json file of the tpk.
Attached is the output of my tpk. Hope that helps
Nagma
Nagma,
Thank you for responding so quickly, this looks very promising. Unfortunately I'm using version 10.2.7 of the SDK and this class doesn't exist. Do you know if this functionality to read the LOD's from a .tpk exists in 10.2.7?
Thank you,
Stefan
Hi Stefan,
I don't think it is possible with 10.2.7. There is no other class to determine the LODs of the local tiled package.
Nagma