Create Vector Tile Package (Data Management)

Summary

Generates vector tiles from a map or basemap and packages the tiles in a single .vtpk file.

Usage

  • The input map must have a description and tags in order for the tool to execute. To add description and tags, right-click the map name in the Contents pane and click Properties. On the Metadata tab, enter a description and some tags to explain the map.

    Some symbology cannot be resolved in the tile-creation process. Avoid symbolizing layers with hatched or gradient fills, markers along lines or polygon outlines, or most symbol effects. Stroke symbol layers with complex dash patterns will be resolved to on or off dashes in the output tiles. The Move effect (often used to mimic drop-shadow effects on building features) is one symbol effect that will be honored.

  • If the resulting tile package is less than 2 GB, you can upload it directly in a browser to ArcGIS Online or ArcGIS Enterprise. Otherwise, use the Share Package tool to upload it to ArcGIS Online or ArcGIS Enterprise.

  • To learn more about creating and symbolizing vector tiles, see Author a map for vector tile creation and Symbology in vector tiles.

Syntax

CreateVectorTilePackage(in_map, output_file, service_type, {tiling_scheme}, {tile_structure}, {min_cached_scale}, {max_cached_scale}, {index_polygons}, {summary}, {tags})
ParameterExplanationData Type
in_map

The map from which tiles are generated and packaged. The input map must have metadata description and tags.

Map
output_file

The output vector tile package. The file extension of the package is .vtpk.

File
service_type

Determines whether the tiling scheme will be generated from an existing map service or if map tiles will be generated for ArcGIS Online, Bing Maps, and Google Maps.

  • ONLINEThe ArcGIS Online/Bing Maps/Google Maps tiling scheme is used. The ArcGIS Online/Bing Maps/Google Maps tiling scheme allows you to overlay your cache tiles with tiles from these online mapping services. ArcGIS Pro includes this tiling scheme as a built-in option when loading a tiling scheme. When you choose this tiling scheme, the data frame of your source map must use the WGS 1984 Web Mercator (Auxiliary Sphere) projected coordinate system. This is the default.
  • EXISTINGTiling scheme from an existing vector tile service will be used. Only tiling schemes with scales that double in progression through levels and have 512-by-512 tile size are supported. You must specify a vector tile service or tiling scheme file in the tiling_scheme parameter.
Boolean
tiling_scheme
(Optional)

A vector tile service or tiling scheme file to be used if the service_type parameter is set to EXISTING. The tiling scheme tile size must be 512 by 512 and must have consecutive scales in a ratio of two.

MapServer; File
tile_structure
(Optional)

Specifies whether the tile generation structure is optimized with an indexed structure or as a flat array of all tiles at all levels of detail. The optimized indexed structure is the default and results in a smaller cache.

  • INDEXEDProduce tiles based on an index of feature density that optimizes the tile generation and file sizes. This is the default.
  • FLATProduce regular tiles for each level of detail without regard to feature density. This cache is larger than that produced with an indexed structure.
String
min_cached_scale
(Optional)

The minimum (smallest) scale at which tiles are generated. This does not have to be the smallest scale in your tiling scheme. The minimum cached scale determines which scales are used to generate cache.

Double
max_cached_scale
(Optional)

The maximum (largest) scale at which tiles are generated. This does not have to be the largest scale in your tiling scheme. The maximum cached scale determines which scales are used to generate cache.

Double
index_polygons
(Optional)

Specifies a pregenerated index of tiles based on feature density, applicable only when the tile_structure parameter is INDEXED. Use the Create Vector Tile Index tool to create index polygons. If no index polygons are specified in this parameter, optimized index polygons are generated during processing to aid in tile creation, but they are not saved or output.

Feature Layer
summary
(Optional)

Adds summary information to properties of the output vector tile package.

String
tags
(Optional)

Adds tag information to the properties of the output vector tile package. Separate multiple tags with commas or semicolons.

String

Code sample

CreateVectorTilePackage example 1 (Python window)

The following script shows how to use the CreateVectorTilePackage tool in the Python window to create vector tile package for the first map that is in the project.

import arcpy
arcpy.env.workspace = "C:/TilePackageExample"
aprx = arcpy.mp.ArcGISProject("CURRENT")
map = aprx.listMaps()[0]
arcpy.CreateVectorTilePackage_management(map, 'Example.vtpk', "ONLINE", "", "INDEXED", 295828763.795777, 564.248588)
CreateVectorTilePackage tool example 2 (stand-alone script)

This stand-alone script shows an example of using the CreateVectorTilePackage tool.

# Name: CreateVectorTilePackage.py
# Description: Find all the maps in the project and
#   create a vector tile package for each map
# import system modules
import os
import arcpy

#set environment settings
arcpy.env.overwriteOutput = True
outputPath = "C://Tilepackages//"

# Loop through the project, find all the maps, and
#   create a vector 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.CreateVectorTilePackage_management(m, outputPath + m.name + '.vtpk', "ONLINE", "", "INDEXED", 295828763.795777, 564.248588)

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics