Add scales to existing cache

978
7
04-08-2018 09:33 PM
ModyBuchbinder
Esri Regular Contributor

Hello all

I have a cache I build with desktop (Using Manage Tile Cache)  with scales 2000,4000,8000

I took very long time to build.

I would like to add levels 16000 and 32000

What will be the best way to add these levels without rebuilding it all.

Thanks

0 Kudos
7 Replies
Asrujit_SenGupta
MVP Regular Contributor
0 Kudos
ModyBuchbinder
Esri Regular Contributor

Thanks for the quick response.

I saw the post, it is talking about server cache not desktop cache.

The Manage Map Server Cache Scales GP tools doing exactly what I need but get a service as parameter and not cache on disk.

The manage tile cache will not let you add scales for existing cache.

0 Kudos
AndrewValenski__IT_
Occasional Contributor III

The Manage Map Server Cache Scales GP tools does allow you to add scales to an existing cache. 

As per the tool's documentation, "Updates the scale levels in an existing cached map or image service. Use this tool to add new scales or delete existing scales from a cache."

Could you expand on what you mean by "cache on disk?"

0 Kudos
ModyBuchbinder
Esri Regular Contributor

I do not use server to build cache and I do not use it in server.

I use Manage Tile Cache GP tool under Data Management-> Tile Cache

I use the cache as local raster for RunTime application.

Thanks

0 Kudos
AndrewValenski__IT_
Occasional Contributor III

And are you consuming the tile cache directly from the bundle files that were generated by the Map Service's cache? 

0 Kudos
ModyBuchbinder
Esri Regular Contributor

Check this example ArcGIS Local Tiled Layer | ArcGIS for Developers  

You can create tpk from cache (using Export Tail Cache GP tool or read the cache (Layers directory) directly.

AndrewValenski__IT_
Occasional Contributor III

Ahhhh, okay you're using a tpk -- makes more sense.

So there is a way you can do this, but I'm sure it isn't supported. But, in case you have a test environment you can test this in, here's the workflow.

In the cache, there should be an .xml documnet (conf.xml) that has the tiling scheme. In it, you'll see several <LOD> tags which represent the various layers of detail (levels). You can delete the appropriate <LOD> from that .XML document, which will tell your tpk to not look for that level. To free up space, there should be various folders within the cache directory (1,2,3,4,5,6,7,etc.) representing the various LODs. After going to your XML and identifying the LOD that corresponds to the scale level you want to get rid of, you can then delete the corresponding folder in the _alllayers folder.

Below is an example of what all this might look like. In the below example, I am interested in deleting the scale level of 4622324.

conf.xml:

<?xml version="1.0" encoding="utf-8" ?><CacheInfo xsi:type='typens:CacheInfo' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:typens='http://www.esri.com/schemas/ArcGIS/10.5'><TileCacheInfo xsi:type='typens:TileCacheInfo'><SpatialReference xsi:type='typens:ProjectedCoordinateSystem'><WKT>PROJCS[&quot;WGS_1984_Web_Mercator_Auxiliary_Sphere&quot;,GEOGCS[&quot;GCS_WGS_1984&quot;,DATUM[&quot;D_WGS_1984&quot;,SPHEROID[&quot;WGS_1984&quot;,6378137.0,298.257223563]],PRIMEM[&quot;Greenwich&quot;,0.0],UNIT[&quot;Degree&quot;,0.0174532925199433]],PROJECTION[&quot;Mercator_Auxiliary_Sphere&quot;],PARAMETER[&quot;False_Easting&quot;,0.0],PARAMETER[&quot;False_Northing&quot;,0.0],PARAMETER[&quot;Central_Meridian&quot;,0.0],PARAMETER[&quot;Standard_Parallel_1&quot;,0.0],PARAMETER[&quot;Auxiliary_Sphere_Type&quot;,0.0],UNIT[&quot;Meter&quot;,1.0],AUTHORITY[&quot;EPSG&quot;,3857]]</WKT><XOrigin>-20037700</XOrigin><YOrigin>-30241100</YOrigin><XYScale>148923141.92838538</XYScale><ZOrigin>-100000</ZOrigin><ZScale>10000</ZScale><MOrigin>-100000</MOrigin><MScale>10000</MScale><XYTolerance>0.001</XYTolerance><ZTolerance>0.001</ZTolerance><MTolerance>0.001</MTolerance><HighPrecision>true</HighPrecision><WKID>102100</WKID><LatestWKID>3857</LatestWKID></SpatialReference><TileOrigin xsi:type='typens:PointN'><X>-20037508.342787001</X><Y>20037508.342787001</Y></TileOrigin><TileCols>256</TileCols><TileRows>256</TileRows><DPI>96</DPI><LODInfos xsi:type='typens:ArrayOfLODInfo'><LODInfo xsi:type='typens:LODInfo'><LevelID>0</LevelID><Scale>591657527.591555</Scale><Resolution>156543.03392800014</Resolution></LODInfo><LODInfo xsi:type='typens:LODInfo'><LevelID>1</LevelID><Scale>295828763.79577702</Scale><Resolution>78271.516963999937</Resolution></LODInfo><LODInfo xsi:type='typens:LODInfo'><LevelID>2</LevelID><Scale>147914381.89788899</Scale><Resolution>39135.758482000092</Resolution></LODInfo><LODInfo xsi:type='typens:LODInfo'><LevelID>3</LevelID><Scale>73957190.948944002</Scale><Resolution>19567.879240999919</Resolution></LODInfo><LODInfo xsi:type='typens:LODInfo'><LevelID>4</LevelID><Scale>36978595.474472001</Scale><Resolution>9783.9396204999593</Resolution></LODInfo><LODInfo xsi:type='typens:LODInfo'><LevelID>5</LevelID><Scale>18489297.737236001</Scale><Resolution>4891.9698102499797</Resolution></LODInfo><LODInfo xsi:type='typens:LODInfo'><LevelID>6</LevelID><Scale>9244648.8686180003</Scale><Resolution>2445.9849051249898</Resolution></LODInfo><LODInfo xsi:type='typens:LODInfo'><LevelID>7</LevelID><Scale>4622324.4343090001</Scale><Resolution>1222.9924525624949</Resolution></LODInfo><LODInfo xsi:type='typens:LODInfo'><LevelID>8</LevelID><Scale>2311162.2171550002</Scale><Resolution>611.49622628137968</Resolution></LODInfo><LODInfo xsi:type='typens:LODInfo'><LevelID>9</LevelID><Scale>1155581.108577</Scale><Resolution>305.74811314055756</Resolution></LODInfo><LODInfo xsi:type='typens:LODInfo'><LevelID>10</LevelID><Scale>577790.55428899999</Scale><Resolution>152.87405657041106</Resolution></LODInfo><LODInfo xsi:type='typens:LODInfo'><LevelID>11</LevelID><Scale>288895.27714399999</Scale><Resolution>76.437028285073239</Resolution></LODInfo><LODInfo xsi:type='typens:LODInfo'><LevelID>12</LevelID><Scale>144447.638572</Scale><Resolution>38.21851414253662</Resolution></LODInfo><LODInfo xsi:type='typens:LODInfo'><LevelID>13</LevelID><Scale>72223.819285999998</Scale><Resolution>19.10925707126831</Resolution></LODInfo><LODInfo xsi:type='typens:LODInfo'><LevelID>14</LevelID><Scale>36111.909642999999</Scale><Resolution>9.5546285356341549</Resolution></LODInfo><LODInfo xsi:type='typens:LODInfo'><LevelID>15</LevelID><Scale>18055.954822</Scale><Resolution>4.7773142679493699</Resolution></LODInfo><LODInfo xsi:type='typens:LODInfo'><LevelID>16</LevelID><Scale>9027.9774109999998</Scale><Resolution>2.3886571339746849</Resolution></LODInfo><LODInfo xsi:type='typens:LODInfo'><LevelID>17</LevelID><Scale>4513.9887049999998</Scale><Resolution>1.1943285668550503</Resolution></LODInfo><LODInfo xsi:type='typens:LODInfo'><LevelID>18</LevelID><Scale>2256.994353</Scale><Resolution>0.59716428355981721</Resolution></LODInfo><LODInfo xsi:type='typens:LODInfo'><LevelID>19</LevelID><Scale>1128.4971760000001</Scale><Resolution>0.29858214164761665</Resolution></LODInfo></LODInfos><PreciseDPI>96</PreciseDPI></TileCacheInfo><TileImageInfo xsi:type='typens:TileImageInfo'><CacheTileFormat>PNG</CacheTileFormat><CompressionQuality>0</CompressionQuality><Antialiasing>false</Antialiasing><BandCount>1</BandCount><LERCError>0</LERCError></TileImageInfo><CacheStorageInfo xsi:type='typens:CacheStorageInfo'><StorageFormat>esriMapCacheStorageModeCompactV2</StorageFormat><PacketSize>128</PacketSize></CacheStorageInfo></CacheInfo>

If you delete the bold text, it should remove the cache's recognition of this LOD.

Then, in the _alllayers folder, you should see a folder for each LOD. I would then delete the folder named '7' that contains the map cache bundle files. 

I'd strongly advise to make backups prior to going through this workflow and doing this in a test/dev environment first. I'm traveling right now, so I can't confirm that the exploded .tpk matches this structure exactly, but when I'm back at a desktop, I can check,

0 Kudos