TPK is a new data file type launched by arcgis10.1. It is mainly used to pack sliced files into offline map packages, TPK can be loaded as a slice basemap in ArcGIS runtime or ArcGIS for Android/IOS. There are multiple methods to create TPK:
Use ArcMap to create a TPK
In arcgis10.1, TPK generation is integrated into ArcGIS for desktop. The production method is as follows:
1. Open ArcMAP, load data in, select Customize-> ArcMap options, select the "sharing" tab in the displayed dialog box, and select "enable ArcGIS runtime Tools ";
2. "share as…" in the File menu ..." There is an option "tile package…" in the menu ...", Select this menu, and the "tile package" dialog box is displayed. set parameters on each tab, which are basically the same as those when the ArcGIS for server map service is released. after entering the parameters, click "analyze ", if an error is reported, modify the parameters according to the error prompt, and click share to create the TPK file:
Use the GP Tool to create a TPK
Another method is to directly use the GP Tool to create TPK.
Select "arctoolbox"-"data management tools"-"create map tile package", as shown below:
Run the GP Tool. The following dialog box is displayed:
Select the map document mxd for creating a TPK and specify the location where the TPK is saved. By default, the slicing format uses PNG. You can set the level based on your needs and click "OK" to complete TPK creation.
Use existing compact slicing to create TPK
1. Composition of TPK files
The TPK file is actually a zip file. By decompressing the TPK file, we can obtain the internal structure of the TPK file, which consists of two folders: esriinfo and v101, for example:
"Trchive" can be replaced with the actual name in your project. The name of other folders or files cannot be changed. The thumbnail folder stores a thumbnail of the slice, and the remaining files are the description file or the configuration information file of the TPK file. Although pkinfo is the suffix name of a file, it is structured in XML; in the v101 folder, we are familiar with the Compact Slicing Data and one. layer file.
Familiar with the TPK structure, it is easy to create a TPK dataset. Create two directories esriinfo and v101 in the project folder according to their composition, and then create other files, there are four files to be created: One thumbnail, two description files, and one layer file.
2. Create Thumbnail (thumbnail)
Create a 200x133 size for the slice, In the PNG format, and save it to the thumbnail folder under the esriinfo directory (this file is also possible in the actual process ).
3. Generate the item. pkinfo File
Create a file item in the esriinfo directory. pkinfo: the content of the file is as follows, and the red part needs to be modified (in fact, it can also be modified for culture = 'zh-cn'. This is different for different countries, because we are all in China, so I skipped this ):
<? XML version = "1.0" encoding = "UTF-8"?>
<? XML-stylesheettype = "text/XSL"
Href = "http://www.arcgisonline.com/home/pkinfostylesheet.xsl"?>
<Pkinfo culture = 'zh-cn'>
F24BC58B-F4A6-4414-921D-B762DE9545F3
<Name> test </Name>
<Version> 10.1pre-release </version>
<Size>-1 </size>
<Created> </created>
<Type> tile package </type>
<Servable> false </servable>
<Packagelocation> </packagelocation>
<Pkinfolocation> </pkinfolocation>
</Pkinfo>
4. Generate the iteminfo. xml file.
Create the iteminfo. xml file in the esriinfo directory. The content of the file is as follows. The red part must be modified. The blue part contains some description information, which can be entered at will:
<? XML version = "1.0" encoding = "UTF-8"?>
<Esri_iteminformationculture = 'zh-cn'>
<Name> test </Name>
<Guid> F24BC58B-F4A6-4414-921D-B762DE9545F3 </GUID>
<Catalogpath> </catalogpath>
<Snippet> test </snippet>
<Description> test </description>
<Summary> test </Summary>
<Title> test </title>
<Tags> test </tags>
<Type> tile package </type>
<Typekeywords>
<Typekeyword> tilepackage </typekeyword>
<Typekeyword> arcgisruntime </typekeyword>
<Typekeyword>. TPK </typekeyword>
</Typekeywords>
<Thumbnail> thumbnail/thumbnail.png </thumbnail>
<Documentation> </documentation>
<URL> </URL>
<Datalastmodifiedtime> </datalastmodifiedtime>
<Extent>
<Xmin>-179.999999999987 </xmin>
<Ymin>-86.3842826037127 </ymin>
<X max> 179.999999999987 </xmax>
<Ymax> 86.3842826106563 </Ymax>
</Extent>
<Spatialreference> wgs_1984_web_mercator_auxiliary_sphere </spatialreference>
<Accessinformation> </accessinformation>
<Licenseinfo> </licenseinfo>
</Esri_iteminformation>
TIPS: You may have noticed that the values of the <Name> and <guid> labels in red are the same in these two configuration files, name is. the name of mxd, GUID is the unique identifier of the world, can be automatically generated using some software. There are many introductions on the guid generation network, which are not described here.
5. Create a layer File
Open ArcMAP, add the slice file to ArcMAP, set the document save attribute to relative path, and save the added slice layer as a layer file. At the same time, copy the generated slicing and layer files to the v101 directory.
6. Pack as TPK
Package the entire project directory as zip and select storage when packaging. Change the file suffix to TPK to get the required TPK file.