AnsweredAssumed Answered

copy layers between webmaps?

Question asked by dcafdg on Dec 3, 2019
Latest reply on Dec 5, 2019 by fcbassongis

SHORT VERSION: I have a webmap for a national set of layers, plus several webmaps containing regional data sets. My goal is to start with the national webmap and add in the layers from the relevant regional webmap for the area where we're working at the moment. I want to save the combined layers from both webmaps to a new webmap. I have figured out how to trace each layer from one webmap back to its source and add that to the other webmap, but this loses any settings that were made in the webmap (e.g.: symbology). How do I merge the layers in two webmaps while preserving the webmap's settings?



I get each webmap as an arcgis.gis.Item and cast it to an arcgis.mapping.WebMap. My regional WebMap object is called reg_webmap, and I loop through the layers like this:

for layer in reg_webmap.layers:


The layer object in the loop is of type PropertyMap. Is there anything I can do with those objects directly to add them to another WebMap? I would like to copy them over with any custom symbology and settings for opacity, title, visibility, etc.


I tried two different methods of adding the regional WebMap's layer objects to the national WebMap:

  1. If I add a hosted feature service to the regional WebMap: As I loop through the layers, each layer object has an itemID, which links me back to the hosted feature layer. I can create an Item object which I can add to the national WebMap.
  2. If I add layers one-by-one to the regional WebMap using the layer-specific URL: The layer won't have an itemID, but will have an URL, which is used to create a FeatureLayer object, which I can add to the national WebMap object.


In either case, the problem is that I'm NOT adding the layer from one WebMap to the other WebMap. Instead, I am using the layers in one WebMap to find their source, and then adding that to the other WebMap. While the end result works, any custom settings in the regional webmap (i.e.: symbology, title, opacity, visibility) are not reflected. In the output.