Label | Explanation | Data Type |
Input Map | The map from which tiles will be generated and packaged. | Map |
Package for ArcGIS Online | Bing Maps | Google Maps
| Specifies whether the tiling scheme will be generated from an existing map service or whether map tiles will be generated for ArcGIS Online, Bing Maps, and Google Maps.
| Boolean |
Output File | The output map tile package. | File |
Tiling Format
| Specifies the format that will be used for the generated tiles.
| String |
Maximum Level Of Detail
| The integer representation corresponding to the number of scales used to define a cache tiling scheme. This scale value defines the maximum level up to which the cache tiles will be generated in the tile package. Larger values reflect larger scales that show more detail but require more storage space. Smaller values reflect smaller scales that show less detail and require less storage space. Possible values are from 1 to 23. The default value is 1. The maximum level of detail value must be greater than the minimum level of detail value. | Long |
Service (Optional) | The name of the map service or the .xml files that will be used for the tiling scheme. This parameter is required only when the Package for ArcGIS Online | Bing Maps | Google Maps parameter is unchecked. | Map Server; File |
Summary (Optional) | Adds summary information to the properties of the package. | String |
Tags (Optional) | Adds tag information to the properties of the package. Multiple tags can be added, separated by a comma or semicolon. | String |
Extent
(Optional) | Specifies the extent that will be used to select or clip features.
| Extent |
Compression Quality (Optional) | A value between 1 and 100 for the JPEG compression quality. The default value is 75 for JPEG tile format and zero for other formats. Compression is supported only for JPEG and mixed formats. Choosing a higher value will result in a larger file size with a higher-quality image. Choosing a lower value will result in a smaller file size with a lower-quality image. | Long |
Package type
(Optional) | Specifies the type of tile package that will be created.
| String |
Minimum Level Of Detail
(Optional) | The integer representation corresponding to the number of scales used to define a cache tiling scheme. This scale value defines the level at which the cache tiles begin to be available and generated in the tile package. Possible values are from 0 to 23. The default value is 0. The minimum level of detail value must be less than or equal to the maximum level of detail value. | Long |
Area of Interest
(Optional) | A feature set that constrains where tiles are created. Use an area of interest to create tiles for irregularly shaped areas or multipart features. The areas outside the bounding box of area of interest features will not be cached. If no value is provided for this parameter, the area of interest will be the full extent of the input map. | Feature Set |
Summary
Generates tiles from a map and packages the tiles to create a single compressed tile package (.tpkx file).
Usage
The input map must include a description and tags for the tool to run. To add a description and tags, right-click the map name in the Contents pane, select Properties, and provide a description and tags on the Description tab.
By choosing PNG for the Tiling Format parameter, the tool will automatically select the correct format (PNG8, PNG24, or PNG32) based on the specified Level of Display value.
This tool honors the Parallel Processing Factor environment. If the environment is not set (the default) or is set to 100, full parallel processing will be enabled and the tool will attempt to distribute the work to all the logical cores on the machine. Setting the environment to 0 will disable parallel processing. Specifying a factor between 1 and 99 will cause the tool to determine the percentage of logical cores to use by applying the following formula, rounded up to the nearest integer:
Parallel Processing Factor / 100 * Logical Cores
If the result of this formula is 0 or 1, parallel processing will not be enabled.
Parameters
arcpy.management.CreateMapTilePackage(in_map, service_type, output_file, format_type, level_of_detail, {service_file}, {summary}, {tags}, {extent}, {compression_quality}, {package_type}, {min_level_of_detail}, {area_of_interest})
Name | Explanation | Data Type |
in_map | The map from which tiles will be generated and packaged. | Map |
service_type | Specifies whether the tiling scheme will be generated from an existing map service or whether map tiles will be generated for ArcGIS Online, Bing Maps, and Google Maps.
| Boolean |
output_file | The output map tile package. | File |
format_type | Specifies the format that will be used for the generated tiles.
| String |
level_of_detail | The integer representation corresponding to the number of scales used to define a cache tiling scheme. This scale value defines the maximum level up to which the cache tiles will be generated in the tile package. Larger values reflect larger scales that show more detail but require more storage space. Smaller values reflect smaller scales that show less detail and require less storage space. Possible values are from 1 to 23. The default value is 1. The maximum level of detail value must be greater than the minimum level of detail value. | Long |
service_file (Optional) | The name of the map service or the .xml files that will be used for the tiling scheme. This parameter is required only when the service_type parameter is set to EXISTING. | Map Server; File |
summary (Optional) | Adds summary information to the properties of the package. | String |
tags (Optional) | Adds tag information to the properties of the package. Multiple tags can be added, separated by a comma or semicolon. | String |
extent (Optional) | Specifies the extent that will be used to select or clip features.
| Extent |
compression_quality (Optional) | A value between 1 and 100 for the JPEG compression quality. The default value is 75 for JPEG tile format and zero for other formats. Compression is supported only for JPEG and mixed formats. Choosing a higher value will result in a larger file size with a higher-quality image. Choosing a lower value will result in a smaller file size with a lower-quality image. | Long |
package_type (Optional) | Specifies the type of tile package that will be created.
| String |
min_level_of_detail (Optional) | The integer representation corresponding to the number of scales used to define a cache tiling scheme. This scale value defines the level at which the cache tiles begin to be available and generated in the tile package. Possible values are from 0 to 23. The default value is 0. The minimum level of detail value must be less than or equal to the maximum level of detail value. | Long |
area_of_interest (Optional) | A feature set that constrains where tiles are created. Use an area of interest to create tiles for irregularly shaped areas or multipart features. The areas outside the bounding box of area of interest features will not be cached. If no value is provided for this parameter, the area of interest will be the full extent of the input map. | Feature Set |
Code sample
The following Python script demonstrates how to use the CreateMapTilePackage function from the Python window.
import arcpy
arcpy.env.workspace = "C:/TilePackageExample"
arcpy.management.CreateMapTilePackage("World Soils", "ONLINE", "Example.tpk", "PNG8", "10")
Find and create map tile packages for all maps in a project.
# Name: CreateMapTilePackage.py
# Description: Find all the maps in the project and
# create a map tile package for each map
# import system modules
import os
import arcpy
# Set environment settings
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:/Tilepackages"
# Loop through the project, find all the maps, and
# create a map tile package for each map,
# using the same name as the map
p = arcpy.mp.ArcGISProject("c:\\temp\\myproject.aprx")
for m in p.listMaps():
print("Packaging " + m.name)
arcpy.management.CreateMapTilePackage(m, "ONLINE", "{}.tpk".format(m.name),
"PNG8", "10")
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes