PROBLEM
Large datasets can cause the process of creating or publishing vector tiles in ArcGIS Pro to run out of memory. If this occurs during caching, you may receive an error message such as “Staging failed” or you may see “Error 999999”.
This has been known to happen with data that has many millions of points or vertices, such as large scale captured point data or small interval contours.
The tool tries to add and process every feature in the data into the root tile. For example, when using the WGS_1984_Web_Mercator_Auxiliary_Sphere coordinate system and the default tiling scheme, the root tile is represented with the “Start Tile” for Level of Detail 0 (LOD 0), as shown on the World Topo Map (MapServer):
If the dataset also covers a large extent, then processing this tile and the tiles in other smaller scales might require many gigabytes of RAM. This can cause the process to fail or take a significantly long time to complete.
Enforce the creation of vector tiles for only the scales that are required for the output. This works best if the layer or vector tiles are not required at smaller scales.
To do this, perform the following steps:

Copy and paste the code below into your IDE of choice (Pycharm, IDLE, Spyder and so on). The lines of code you need to alter are the project_path, map, layer, min_scale, min_cached_scale, max_cached_scale, and output_file variables. This script does the following:
# Import system modules
import arcpy
import os
#Get Projectpath
script = os.getcwd()
project_path = os.path.join(script, r"myProject.aprx")
aprx = arcpy.mp.ArcGISProject(project_path)
arcpy.env.overwriteOutput = True
map = aprx.listMaps("Original map")[0]
layer = map.listLayers("POI")[0]
print(layer.name)
# Set the desired scale range on the 'POI' layer
# Set the Visible Scale Range on the layer
min_scale = 36112 # Minimum scale (zoomed out) is (1:36,112)
if layer.isFeatureLayer:
layer.minThreshold = min_scale
print(f"Set Minimum scale (zoomed out) for layer: '{layer.name}' to minScale: {min_scale}")
else:
print(f"'{layer.name}' is not a FeatureLayer and cannot have scale ranges set.")
# Set parameter values for Create Vector Tile Package tool
# Set the Minimum Cached Scale and Maximum Cached Scale parameters to only
# use the scales that are required in the output
# Save the changes made to the project
output_file = os.path.join(script, r"Example.vtpk")
min_cached_scale = 36111.909643
max_cached_scale = 564.248588
service_type = "ONLINE"
tiling_scheme = None
tile_structure = "INDEXED"
index_polygons = None
summary = "Vector tiles for scales LOD13 and beyond"
tags = "vt"
arcpy.management.CreateVectorTilePackage(map, output_file, service_type, tiling_scheme, tile_structure, min_cached_scale, max_cached_scale, index_polygons, summary, tags)
print(f"Vector tile package '{output_file}' created for map '{map.name}' ")
aprx.save()
print("Project saved!")
Article ID: 000036053
Get help from ArcGIS experts
Start chatting now