Copy Symbology form one ArcGIS Layer to Another

5612
9
Jump to solution
04-27-2017 02:25 PM
MichaelBartlett
New Contributor III

I would like to copy the symbology from one arcgisonline feature layer to another.  It is just a point symbol.  I have tried going to the rest / Admin and UpdateDefinition.  The trying to replace the DrawingInfo Renderer, but it does not seem to stick, even if I just try changing the size of the exiting one.

Is it possible to do this?  If so, what are the steps?  Do I need to be in HTML or JSON mode or does it matter?

If I can figure this out, it will save me a ton of time.  Or if there is already a tool out there that facilitates this, that would be just as good.

Tags (2)
1 Solution

Accepted Solutions
KellyGerrow
Esri Frequent Contributor

Hey mjbiti‌,

Try the same method again and either delete the Lasteditdate entry in the formatted json, or just add the section you will be changing.

Let  me know if that works,

Kelly

View solution in original post

9 Replies
KellyGerrow
Esri Frequent Contributor

Hi Michael,

What is the data source that you are using a feature collection, feature service or tiled service? Can you provide some details about what you are trying to do with the copied symbology? Can you provide your workflow?

Kelly

0 Kudos
MichaelBartlett
New Contributor III

Kelly,

Sorry for the delay, hopefully you have not given up on me.  new to this forum and i didn't notice anyone had replied.

Here is my workflow.

In the featureLayer, click on the Service URL of one of the layers.

replace ../rest/services/... with .../rest/admin/services/...

At the bottom, click Update Definition

Here, I replace the part after "drawingInfo":{"Renderer":("type":"simple","symbol":

with the symbol I copied from another featurelayer.

Howerver, for testing sake, I also just tried changing the Height and Width of the existing text from 9 to 29.

I leave the Asynch option to False and Format to HTML
Then I click the Update Layer Definition Button.

I get an error saying:
Invalid definition for 'LastEditDate'.
Invalid definition for ESRI.ArcGIS.SDS.Metadata.EditingInfo

If I change the Asynch Option to True and click the Update Button it looks like it works,
but if i go back to the Visualization tab on the feature layer, it says I need to save my changes, I do, but it doesn't appear anything has changed.

KellyGerrow
Esri Frequent Contributor

Hey mjbiti‌,

Try the same method again and either delete the Lasteditdate entry in the formatted json, or just add the section you will be changing.

Let  me know if that works,

Kelly

MichaelBartlett
New Contributor III

Thanks Kelly for your help.
It seems the easiest thing is to use the Admin Rest URL and update only the “Drawing Info Section”
For some reason, if I used all the default text in the Update box, and changed the drawing info information, I would receive errors (or worse, no error but nothing was changed).
For other people who are looking for help doing this, here is my methodology.
1) Go to the Service URL of the layer you want to copy from:
2) Switch to JSON view.
3) Copy the “drawingInfo” section, or copy the whole thing and delete everything but the “drawingInfo” section
4) Make sure you have the beginning and ending Curly braces surround it (example  below)
{
   "drawingInfo": {
      "renderer": {
         "type": "simple",
         "label": "",
         "description": "",
         "symbol": {
            "color": [133, 0, 11, 255],
            "size": 3,
            "angle": 0,
            "xoffset": 0,
            "yoffset": 0,
            "type": "esriSMS",
            "style": "esriSMSCircle",
            "outline": {
               "color": [0, 0, 0, 255],
               "width": 1,
               "type": "esriSLS",
               "style": "esriSLSSolid"
            }
         }
      },
   "transparency": 0
   }
}
5) Open the Target Layer’s Service URL
6) Go to Admin mode by adding the /admin (parameter? / keyword?) in the Url
i.e replace ../rest/services/... with .../rest/admin/services/...
7) At the bottom under Supported Operations, click on “Update Definition”
😎 Replace the text in the box, with the drawingInfo text from the other layer you copied.
9) Leave ASync to False and Format to JSON (what I did, not sure what changing actually does)
10) Click the Update layer Defintion Button
11) If it worked you will get this message { "success" : true }

PaulDohertyFEMA
New Contributor III

This solution worked for me with some fairly complex symbology changes (pointing to hosted png for +24 unique symbols). Thank you all for posting!

p.s. I too had to clear out the last edit date with " " as per https://community.esri.com/t5/arcgis-online-questions/unable-to-update-feature-service-layer-definit...

GIS_utahDEM
Occasional Contributor II

@PaulDohertyFEMA Would you be able to post how you were able to do this with hosted pngs for symbols?

I'm new using the ServiceURL, but I think I get the gist of it. I have very complicated symbology (15 unique png symbols AND size change based on value) that I would ideally like to copy to over 100 view layers in their over 100 respective maps (I am using an api for python script to create the view layers and maps), I'm pretty sure I can update the drawinginfo within the python script, but I'm just not sure what to change it to in order to make my symbology work. I would settle for just being able to automatically apply the symbols and manually having to resize if I have to 🙂

0 Kudos
PaulDohertyFEMA
New Contributor III
Good question! I think for this process, I initially setup the web map using hosted symbology in the old web map viewer (documentation, don't think this is possible in the new web map viewer as of 12/6/21). Then copied the symbology json from that original web map to the new web map json. I hope that helps!
0 Kudos
Jaivik_P
New Contributor III

Thanks very much for sharing this solution @MichaelBartlett. Your instructions are well written and easy to follow. I applied your solution with ArcGIS Enterprise hosted feature service and it worked like a charm! 🙂

0 Kudos
SylvainBoivin
New Contributor III

Hi, i.m trying to do the same.. copy symbology from AGOL Layer to Entreprise layer but when i am in the Enterprise portal, i clic on update definition in admin mode on the target layer, the box is empty so its impossible for me to replace the drawinginfo part. Do you have an idea why the input box is empty? thanks for your consideration and helpSans titre.png