While creating Vector Tile package creation using the selected layer extent, the output vtpk does not have the selected extent.Please review my code and correct it.
project=arcpy.mp.ArcGISProject(r"e:\projects\waldo\CREATE_VTPK_PACKAGE.aprx")
map = project.listMaps("LANDBASE")[0]
layer = map.listLayers("PLAT GRID")[0]
arcpy.analysis.Select(layer, r"E:\Projects\Waldo\CREATE_VTPK_PACKAGE.gdb\WC_ID_1555", "WC_ID =1555")
lyt = project.listLayouts("LBELayer_WALDO")[0]
mf = lyt.listElements('MAPFRAME_ELEMENT',"Layers Map Frame")[0]
ext = mf.camera.getExtent()
mf.map.addDataFromPath(r"E:\Projects\Waldo\CREATE_VTPK_PACKAGE.gdb\WC_ID_1555")
WC_ID = map.listLayers()[0]
mf.camera.setExtent(mf.getLayerExtent(WC_ID,True,True))
ext = mf.camera.getExtent()
map.defaultCamera.setExtent(mf.getLayerExtent(WC_ID,True,True))
layers= map.listLayers()
for l in layers:
if l.name=="WC_ID_1555":
map.removeLayer(l)
project.save()
arcpy.management.CreateVectorTileIndex(map, r"E:\Projects\Waldo\CREATE_VTPK_PACKAGE.gdb\IDX_1555", "EXISTING", r"C:\Users\AppData\Local\ESRI\Geoprocessing\VTTS_4326_GCS_WGS_1984.xml", 10000)
arcpy.management.CreateVectorTilePackage(map, "E://Projects//Waldo//MobileMapPackages//VTPK_FILES//1_1555"+'.vtpk', "EXISTING",Tiling_Schema, "INDEXED", 295829355.454566, 0, r"E:\Projects\Waldo\CREATE_VTPK_PACKAGE.gdb\IDX_1555")
project.save()
What was the outcome?
What is expected?
Were there errors? (since the code can't be tested)
Hi Dan,
There are no Errors,The Extent is not getting set properly ,the Map extent (LandBase)is being set but not the Selected Extent(ID).