Python API (AGOL) - WebMap View layer does not appear in Collector

891
3
06-11-2019 12:47 PM
MaximeCampeau
New Contributor II

Hello ! 

I have a script automating map generation. It basically creates an empty WebMap instance and adds a Hosted View in it. Although I am able to get the WebMap to show in Collector (by editing the WebMap typeKeywords), the layer itself does not show. It appears in the layer tab, but does not show in the map viewer. 

I am lost, since when I save a duplicate of this map via AGOL it works perfectly! Anybody has an idea?

Thanks

0 Kudos
3 Replies
simoxu
by MVP Regular Contributor
MVP Regular Contributor

Can you view the generated web map properly in the Map Viewer in AGOL? and check the permission of this map, when you save a web map, you are the owner of the copy.

0 Kudos
MaximeCampeau
New Contributor II

Hello simo ! Yes I can view the Web Map properly in the viewer! And the map sharing's properties are as desired, which is group only. So is the View Layer featured in the Web Map. 

Earlier yesterday, I could not get the Web Map to appear in Collector. By adding this snippet in the Web Map properties, I was able to get it to show. That being said, the points hosted in the view do not appear on the map (although, in the layer menu, I can see the layer in Collector).

Here's the snippet I added : 

empty_webmap = WebMap()
empty_webmap.add_layer(view_item, options={'title': view_name})
webmap_item_properties = {'title': str(municipality) + '_Implantation', 
                          'snippet': str(municipality) + '_Implantation', 'tags': '2019',
                          "typeKeywords": ['ArcGIS Online', 'Collector', 'Data Editing', 
                          'Explorer Web Map', 'Map', 'Offline', 'Online Map', 'Web Map']}
empty_webmap.save(webmap_item_properties)
0 Kudos
simoxu
by MVP Regular Contributor
MVP Regular Contributor

I'd suggest you to get JSONs  of the generated webmap and the save-as copy of the same webmap using agol assistant and compare the content of the JSON to see the difference, then you can adjust your code accordingly.

0 Kudos