Select to view content in your preferred language

Creating a mobile map package for an arbitrary area of interest

28
1
5 hours ago
padmalcom
Occasional Contributor

Hi, we are trying to export a part of a map to a mobile map package. My approach looks like that:

import os
import arcpy
from arcgis.geometry import Polygon

root_dir = "C:\\Users\\mobile\\Alex\\Projects\\ArcGIS\\Mist1"
in_aprx = "Mist1.aprx"
map_name = "Map"

project = arcpy.mp.ArcGISProject(os.path.join(root_dir, in_aprx))
world_map = project.listMaps(map_name)[0]

aoi_def = {
"paths" : [[[-97.06138],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832]],
[[-97.06326,32.759],[-97.06298,32.755]]],
"spatialReference" : {"wkid" : 4326}
}

aoi = Polygon(aoi_def)

arcpy.management.CreateMobileMapPackage(
in_map = world_map,
output_file = r"c:\\Users\\mobile\\MobileMapPackage1.mmpk",
in_locator = None,
area_of_interest = aoi
)

Unfortunately, CreateMobileMapPackage does not accept a polygon as area of interest but requires a full blown feature layer. My question is: How do I programmatically create such a feature layer consisting of 4 pairs or longitude and latitude?

0 Kudos
1 Reply
DanPatterson
MVP Esteemed Contributor

paths" : [[[-97.06138],[-97.06133,32.8 ....

missing something in the first pair ... is it a copy/paste error or did your code throw and error message


... sort of retired...
0 Kudos