Select to view content in your preferred language

how to update individual offline packages with the python api

374
1
12-07-2023 09:07 AM
TracyLove
Emerging Contributor

online in field map designer : /offline/ map areas / manage areas/
i can refresh or update individual offline packages.

Unfortunately in the python api i appear to only be able to update offline map areas.
which needlessly updates all of the related offline packages.

https://developers.arcgis.com/python/guide/managing-offline-map-areas/#updating-offline-areas
https://developers.arcgis.com/python/api-reference/arcgis.mapping.toc.html?#arcgis.mapping.OfflineMa...

I can enumerate the offline packages...

wmItem = agolSpace.content.get(MapId)
wm = arcgis.mapping.WebMap(wmItem)
for oma_item in wm.offline_areas.list():
for pkg in oma_item.related_items('Area2Package', 'forward'):
if ('SQLite' in pkg.type):
print(pkg.homepage)

is there some way in the python api to update individual packages?
is there a way to identify the relationship between a map layer and the offline packages that may be generated from it?

1 Reply
usdajoy
Emerging Contributor

@TracyLove   Did you ever figure this out?  I can specify the individual package to update but it doesn't appear to do anything and I don't get the printout of job status when I set env.verbose = True.   I am stuck here :

wm_item = gis.content.get(some_web_map_id)
wm_obj = WebMap(wm_item)
for offline_item in wm_obj.offline_areas.list(): #find offline maps related to web map


rel_items = offline_item.related_items('Area2Package', 'forward') #find packages related offline map
for r in rel_items:

if 'Package_I_Want_To_Update' in r.title: #search for package by name


pkg_id = r.id
update_results = wm_obj.offline_areas.update([{'itemId':pkg_id}]) #this returns None

0 Kudos