planned workflow

1061
5
04-10-2018 10:22 PM
xipeng1
New Contributor

Hello, I want to ask developers conference you demonstrate the preplanned workflow, I still don't succeed, performed sw_map. Offline_areas. Create the line of code, whether can be in Storm - water folder to generate an item, but I didn't, why? The other question is, do I need to execute the Setup Map Area? 

Demo address is https://www.youtube.com/watch? V = 3 q - JoOkW4Vo

There's no Setup Map Area used in video.

0 Kudos
5 Replies
xipeng1
New Contributor

My mistakes are as follows.

0 Kudos
AnttiKajanus1
Occasional Contributor III

Hi,

I'm assuming that you are using ArcGIS API for Python to create the areas. How did you create the areas and what did it report back? It looks like that it couldn't create the package for some reason. Could you share your script (if you cannot share it publically, you can send it to me directly akajanus@esri.com). 

Note that you have to create the areas with the user that owns the webmap that you are targeting. Also make sure that when you access areas from the runtime application, you hook authentication manager to handle the sign in so that the task has access to the items. 

0 Kudos
xipeng1
New Contributor

Thank you very much. I will send you an email.

0 Kudos
AnttiKajanus1
Occasional Contributor III

Here is an example how to use the 1.4 ArcGIS API for Python to create areas based on bookmarks.

# Imports
from arcgis import env
from arcgis.gis import GIS
from arcgis.mapping import WebMap

# Set verbosity level
env.verbose = True

# Setup organization and user information
portal = "https://myorganization.maps.arcgis.com"
user = "my_user"
password = "my_password"
webmap = "my_portal_itemid"
gis = GIS(portal, user, password)

# get the webmap to use offline
offline_map_item = gis.content.get(webmap)
offline_webmap = WebMap(offline_map_item)

# Cleanup and remove existing preplanned areas
print("deleting existing areas")
offline_areas = offline_webmap.offline_areas
if offline_areas.list():
    for area in offline_areas.list():
        print("deleting area: " + area.name)
        area.delete()
        print("deleted")
 
# Loop through the webmap's bookmarks and try to create a map area for each one
print("creating new areas based on the bookmarks")
for bookmark in offline_webmap.definition.bookmarks:
    name = bookmark.name
    print("submitting jobs for: " + name)
    offline_area = offline_areas.create(area=name, title=name, snippet="Snippet for area:" + name)
    print("job complete for:  " + name)
0 Kudos
JoeHershman
MVP Regular Contributor

Are you aware if this offline area functionality will be added to ArcGIS Enterprise anytime soon?

Thanks,
-Joe
0 Kudos