View tile package (.tpk) at all levels of detail.

4355
9
09-05-2017 09:10 AM
NicholasVolpe
New Contributor

We are using a tile package as a base map for offline use. However, to keep the tile package file size as small as possible, we do not download all the levels of detail. But the tile package will disappear when zoomed in 'beyond' or 'beneath' it.  

Is there a way to keep the Tile Package displayed even if the map is zoomed in to lower levels of details, and there is not a matching level of detail in the tile package. I know the image will be disported and pixelated. But it would be better than an empty map.

Thanks,

Nick

0 Kudos
9 Replies
NagmaYasmin
Occasional Contributor III

Hi Nick,

You could use ArcGISTIledLayer.NoDataTileBehavior property (ImageTiledLayer.NoDataTileBehavior Property) to display the tiles even there are no levels defined. Basically that property will resample the tiled layer where the tiles don't exist.

ArcGISTiledLayer Class  --> NoDataTileBehavior. 

"The value controls how a tile returning 'NoData' will be resampled."

Hope that helps.

Nagma

0 Kudos
NicholasVolpe
New Contributor

Nagma, Thanks your reply on GeoNet

I wanted to double check I have this right, because I cannot seem to get

the behavior to change.

Below is the code I am using:

ArcGISTiledLayer localTiledLayer = new

ArcGISTiledLayer(new Uri(file.Path)) { Id = LOCAL_LAYER_ID };

localTiledLayer.NoDataTileBehavior =

NoDataTileBehavior.UpSample;

localTiledLayer.Name = "Tile package layer";

localTiledLayer.Id = "TilePackageLayer";

if (localTiledLayer.LoadStatus !=

Esri.ArcGISRuntime.LoadStatus.Loaded)

await localTiledLayer.LoadAsync();

MyMapView.Map.Basemap.BaseLayers.Add(localTiledLayer);

I have tried all the properties on the NoDataTileBehavior (UpSample, Show,

Blank). None of them have seemed to change the behavior. The tile package

which is saved as a TiledLayer to the base layers disappears when it is too

far zoomed out or too far zoomed in. Also, the Blank property does not seem

to do anything.

Thanks,

Nick.

0 Kudos
dotMorten_esri
Esri Notable Contributor

Did you try setting the MaxScale on the tiled layer to something very very small?

NicholasVolpe
New Contributor

Thanks Morten! that worked for MaxScale. If I set the MaxScale to a very small number, I can continue to zoom in very close and keep the tile package displayed.. 

How about on the flip side of that? Can I keep the tile package displayed when the map is zooming out? I've tried playing around with the min and max scales, but no luck so far. 

Thanks again for your help.

0 Kudos
dotMorten_esri
Esri Notable Contributor

I believe minscale has a limit, or you'll risk loading 1000s of tiles.

If you want to show data at more scales, you really should generate tiles for more scales.

0 Kudos
SkyWatch
New Contributor

The link between NoDataTileBehavior and MaxScale is not obvious, so thanks Morten Nielsen. The documentation of NoDataTileBehavior could really need a note on this.

0 Kudos
dotMorten_esri
Esri Notable Contributor

Our SDK team has logged an issue to improve the doc. Thanks for the feedback!

0 Kudos
NagmaYasmin
Occasional Contributor III

Hi Nick,

One thing I would like to mention about the NoDataTileBehavior, it doesn't resample the image tile at any scale. The purpose of this is that to enlarge the image and fill up the levels where no tiles are available.
Suppose, for a basemap tile layer you may not have the data beyond any specific level for some area but for some area you have the data beyond that specific level. NoDataTileBehavior enlarges the images of the area all over to the last level to have consistent display of the tiles. Hope that explains the behavior you are seeing at your side.

Best,

Nagma

0 Kudos
Orca654
New Contributor III

I have similar issue to use map tile package inside the Explorer for ArcGIS.  I have a easy way to solve this issue by either edit the conf.xml inside the .tpk (zipped) file or provide special "service" file while you create map tile package.  https://community.esri.com/message/880732-make-tile-package-tpk-visible-at-all-scales 

0 Kudos