within the script I can target which map I add/remove/modify layers. This has help streamline the process. But I still have 3 scripts instead of 7. I still get tripped up in 2 places....
When I am processing layers and I want to add them to the map to output a mobile map package, I can specify the map to add the layers, and then I can turn them off as I don't want them visible, but usable by the app.
# --- gets the current ArcGIS Pro project file
aprx = arcpy.mp.ArcGISProject("CURRENT")
# --- gets the target map
m = aprx.listMaps("MMPK Output*")[0]
# --- sets the path and layers to add
LayerPath = ("D:\\Mobile Map Package Creator\\map_data.gdb\\")
LayerList = ("COMPLEXES", "MILEMARKERS", "Zones", "ROAD_NAMES")
# --- loops thru the layers and adds them to the target map, and then turns the visibility off
for Layer in LayerList:
AddStatus = m.addDataFromPath(LayerPath + Layer)
LayerName = m.listLayers(Layer)[0]
VisibleState = LayerName.visible = 0 #turn off layer
What trips me up?
The extent needs to be entered as a property of the map to create a vector tile cache, I can't find a way to do that in python.
I can't seem to use the above python to add a Network Dataset to the map.