WebMap Created with Python API missing from Collector

263
1
06-11-2020 07:20 AM

 Hi I 've created WebMap  and sheared it to Group with Python API . all went well and I can view it and edit it in ArcGis Online but the map is missing from collector. only after I open the map in ArcGis Online and Save it from there I could see it in the collector.

I have exported the JSON files for before and after the change, and notice there are some differences.

Maybe the code for new WebMap is missing something.

this is the code I used to create the WebMap:

#create webmap in AGOL and add the Layers and save
Survey_Webmap = WebMap()
SurLyr=gisCon.content.get(known_item_id)
Survey_Webmap.add_layer (SurLyr)
webmap_item_properties = {'title':SurTitle+"_WM",'tags':['Surveys'],'snippet':'Survey of Israel'+surv_id}

#search for the created webmap item id
Survey_Webmap.save(item_properties=webmap_item_properties,folder= myFolder)
search_result_SurWebMap = gisCon.content.search(query=SurTitle+"_WM", outside_org=False)
first_item = search_result_SurWebMap[0]
known_WebMapitem_id = first_item.id
print(known_WebMapitem_id)


try:
    first_item.share(org=False,groups=SurveyGrp,everyone=False)
    print("Successfully shared item group")
except Exception as err:
    print("Something went wrong...")
    print(str(err))

 I'm attaching the Json Files and  2 images that shows the differences.

can anyone help me on this ?

Tags (2)
0 Kudos
1 Reply

Hi,

I got it to work for me, though I think it some kind of bug since this parameter should be derive for the layers in the webmap, exactly as it work manually.

In any case this is my solution:

Add the keyword "typeKeywords" to "item_properties" and,  specify "'Collector', 'Data Editing'" that are missing when Arcgis Python API creates the webmap.

#create WebMap
Survey_Webmap = WebMap()

#add oprational ediable layer
SurLyr=gisCon.content.get(known_item_id)
Survey_Webmap.add_layer (SurLyr)

#create WebMap Item Prop
webmap_item_properties = {'title':SurTitle+"_WM",'tags':['Surveys'],'snippet':'Survey of Israel'+surv_id,'typeKeywords':['ArcGIS Online', 'Collector', 'Data Editing', 'Explorer Web Map', 'Map', 'Offline', 'Online Map', 'Web Map']}

#save the map 
Survey_Webmap.save(item_properties=webmap_item_properties,folder= myFolder)

 hope it helps someone,

iris 

0 Kudos