Add a Feature Layer Collection to an existing WebMap

959
1
Jump to solution
02-25-2022 03:05 AM
MVAC
by
New Contributor III

Hello,

I want to add a Feature Layer Collection to an existing WebMap. My WebMap already has layers, but I want to add the ones on my Feature Layer Collection. I tried using 'add_layer' but I get the following error:

AttributeError: 'list' object has no attribute 'add_layer'

 

# get webmap
dispatchers_map = gis.content.search(f'title:{name_project} Dispatcher Map', 
                                    'Web Map',
                                    outside_org=False)

# get feature layer collection
f_layer = gis.content.search(f'title:{pr_layer}', 
                                    'Feature layer',
                                    outside_org=False)

# add flc to webmap
dispatchers_map.add_layer(f_layer)

 

 

Thanks

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
MVAC
by
New Contributor III

I found the way 🙂

# using WebMap to use my web map
dispatcher_map = WebMap(disp_map)
print(dispatcher_map)

# add_layer
dispatcher_map.add_layer(f_layer[0])

# properties
webmap_item_properties = {'title':'name of existing Web Map'}

# update web map
dispatcher_map.update(webmap_item_properties)

 

View solution in original post

0 Kudos
1 Reply
MVAC
by
New Contributor III

I found the way 🙂

# using WebMap to use my web map
dispatcher_map = WebMap(disp_map)
print(dispatcher_map)

# add_layer
dispatcher_map.add_layer(f_layer[0])

# properties
webmap_item_properties = {'title':'name of existing Web Map'}

# update web map
dispatcher_map.update(webmap_item_properties)

 

0 Kudos