Hi,
I am relatively new to Python. I have created a script to create 8 Mobile Map Packages, 1 for each area required. I was just wondering if there is a better or more efficient way to write the code? Possibly looping through each area.Each one uses the same Map File but clips each based off a different layer file. I have the script scheduled to run weekly yo update each with the latest data. Any help, tips or advice would be greatly appeciated.
Thanks
import arcpy
arcpy.env.overwriteOutput = True
# Local Input Variables:
inputmapfile = r"'\\filelocation\Water Map Files\Water Network.mapx'"
inputn1layerfile = r"\\filelocation\Water Layer Files\North_1.lyrx"
inputn2layerfile = r"\\filelocation\Water Layer Files\North_2.lyrx"
inputs1layerfile = r"\\filelocation\Water Layer Files\South_1.lyrx"
inputs2layerfile = r"\\filelocation\Water Layer Files\South_2.lyrx"
inpute1layerfile = r"\\filelocation\Water Layer Files\East_1.lyrx"
inpute2layerfile = r"\\filelocation\Water Layer Files\East_2.lyrx"
inputw1layerfile = r"\\filelocation\Water Layer Files\West_1.lyrx"
inputw2layerfile = r"\\filelocation\Water Layer Files\West_2.lyrx"
# Local Output Variables
north1outputfile =r"\\filelocation\Mobile Map Packages\North 1 Water Network.mmpk"
north2outputfile =r"\\filelocation\Mobile Map Packages\North 2 Water Network.mmpk"
south1outputfile =r"\\filelocation\\Mobile Map Packages\South 1 Water Network.mmpk"
south2outputfile =r"\\filelocation\\Mobile Map Packages\South 2 Water Network.mmpk"
east1outputfile =r"\\filelocation\\Mobile Map Packages\East 1 Water Network.mmpk"
east2outputfile =r"\\filelocation\\Mobile Map Packages\East 2 Water Network.mmpk"
west1outputfile =r"\\filelocation\\Mobile Map Packages\West 1 Water Network.mmpk"
west2outputfile =r"\\filelocation\\Mobile Map Packages\West 2 Water Network.mmpk"
# Process: Create Water Packages
arcpy.CreateMobileMapPackage_management(inputmapfile, north1outputfile, in_locator="", area_of_interest= inputn1layerfile, extent="DEFAULT", clip_features="CLIP", title="North 1 Water Network", summary="Mobile Map Package of the North 1 Water Network", description="", tags="Water Network, North 1", credits="", use_limitations="", anonymous_use="STANDARD", enable_map_expiration="DISABLE_MAP_EXPIRATION", map_expiration_type="ALLOW_TO_OPEN", expiration_date="", expiration_message="This map is expired. Contact the map publisher for an updated map.")
arcpy.CreateMobileMapPackage_management(inputmapfile, north2outputfile, in_locator="", area_of_interest= inputn2layerfile, extent="DEFAULT", clip_features="CLIP", title="North 2 Water Network", summary="Mobile Map Package of the North 2 Water Network", description="", tags="Water Network, North 2", credits="", use_limitations="", anonymous_use="STANDARD", enable_map_expiration="DISABLE_MAP_EXPIRATION", map_expiration_type="ALLOW_TO_OPEN", expiration_date="", expiration_message="This map is expired. Contact the map publisher for an updated map.")
arcpy.CreateMobileMapPackage_management(inputmapfile, south1outputfile, in_locator="", area_of_interest= inputs1layerfile, extent="DEFAULT", clip_features="CLIP", title="South 1 Water Network", summary="Mobile Map Package of the South 1 Water Network", description="", tags="Water Network, South 1", credits="", use_limitations="", anonymous_use="STANDARD", enable_map_expiration="DISABLE_MAP_EXPIRATION", map_expiration_type="ALLOW_TO_OPEN", expiration_date="", expiration_message="This map is expired. Contact the map publisher for an updated map.")
arcpy.CreateMobileMapPackage_management(inputmapfile, south2outputfile, in_locator="", area_of_interest= inputs2layerfile, extent="DEFAULT", clip_features="CLIP", title="South 2 Water Network", summary="Mobile Map Package of the South 2 Water Network", description="", tags="Water Network, South 2", credits="", use_limitations="", anonymous_use="STANDARD", enable_map_expiration="DISABLE_MAP_EXPIRATION", map_expiration_type="ALLOW_TO_OPEN", expiration_date="", expiration_message="This map is expired. Contact the map publisher for an updated map.")
arcpy.CreateMobileMapPackage_management(inputmapfile, east1outputfile, in_locator="", area_of_interest= inpute1layerfile, extent="DEFAULT", clip_features="CLIP", title="East 1 Water Network", summary="Mobile Map Package of the East 1 Water Network", description="", tags="Water Network, East 1", credits="", use_limitations="", anonymous_use="STANDARD", enable_map_expiration="DISABLE_MAP_EXPIRATION", map_expiration_type="ALLOW_TO_OPEN", expiration_date="", expiration_message="This map is expired. Contact the map publisher for an updated map.")
arcpy.CreateMobileMapPackage_management(inputmapfile, east2outputfile, in_locator="", area_of_interest= inpute2layerfile, extent="DEFAULT", clip_features="CLIP", title="East 2 Water Network", summary="Mobile Map Package of the East 2 Water Network", description="", tags="Water Network, East 2", credits="", use_limitations="", anonymous_use="STANDARD", enable_map_expiration="DISABLE_MAP_EXPIRATION", map_expiration_type="ALLOW_TO_OPEN", expiration_date="", expiration_message="This map is expired. Contact the map publisher for an updated map.")
arcpy.CreateMobileMapPackage_management(inputmapfile, west1outputfile, in_locator="", area_of_interest= inputw1layerfile, extent="DEFAULT", clip_features="CLIP", title="West 1 Water Network", summary="Mobile Map Package of the West 1 Water Network", description="", tags="Water Network, West 1", credits="", use_limitations="", anonymous_use="STANDARD", enable_map_expiration="DISABLE_MAP_EXPIRATION", map_expiration_type="ALLOW_TO_OPEN", expiration_date="", expiration_message="This map is expired. Contact the map publisher for an updated map.")
arcpy.CreateMobileMapPackage_management(inputmapfile, west2outputfile, in_locator="", area_of_interest= inputw2layerfile, extent="DEFAULT", clip_features="CLIP", title="West 2 Water Network", summary="Mobile Map Package of the West 2 Water Network", description="", tags="Water Network, West 2", credits="", use_limitations="", anonymous_use="STANDARD", enable_map_expiration="DISABLE_MAP_EXPIRATION", map_expiration_type="ALLOW_TO_OPEN", expiration_date="", expiration_message="This map is expired. Contact the map publisher for an updated map.")