How to Reconfigure Layer Files in ArcGIS Pro

Symbology is one of those things that can make or break a map. If it is not clear and intuitive, users can be left feeling frustrated by the lack of clarity and the amount of time it takes to find what they are looking for. (I can’t be the only person who walks away grumbling like a Clint Eastwood vigilante every time I look at a poorly symbolized map, right!?) That being said, I do think it is something we take for granted – both as non-cartographer GIS professionals and regular people looking at a map. In some instances, you may be given a legacy map from someone in your organization with symbology that has been agreed upon and should not be changed. Other times, you may be using an ArcGIS Online solution that came preconfigured with fancy symbology. When that happens, we can go about our work without worrying about symbols; someone has kindly taken care of it beforehand. The thing is, as time goes on, we all end up needing to change something in our data for one reason or another. Through the changes, maintaining consistent symbology is still critical.

I recently ran into this exact situation, but due to different field configurations, I could not simply import the layer file and call it a day. The layers I was working with were symbolized using a short integer field with a coded value domain. Each layer contained the exact same field. The codes were integers, providing essentially no meaning to the field crew, while the descriptions gave the name of each feature type. For reasons irrelevant to this article, I needed to transition to a string field while maintaining the symbology in the original map. I could have done this manually, of course, but saving every symbol individually would have been incredibly time consuming. This led me to edit the layer file. You can do this by right-clicking the file in File Explorer and opening in your text editor of choice. Below, I explain how I modified my layer files. Follow along if you find yourself in the same position.

1. Add a new text field to all required layers.

  • assetType_string

2. Calculate the description from the original field with the coded values using this Arcade expression:

  • DomainName($feature, “assettype”)
    *Note: you will need to replace “assettype” with the original field name in your data.

3. Before changing the symbology, but after adding the new field (this is important!), create a “string” layer file for editing in the next steps. (This is just a copy of the original symbology but will include the new field. I simply added “string” to the end of the default file name.)

4. Once you have created the layer file, right-click the .lyrx file in File Explorer and open it with VSCode or a text editor of your choice.

5. Scroll down toward the bottom until you reach a section of code that looks like the screenshot below. Alternatively, you can search for “groups”. On row 1701, we see the name of the field used to originally symbolize the data (“assettype”). Replace the field name on this line with the name of the field you added in Step 1 (“assetType_string”, in my case).

6. A few lines below, you will see a section called “groups”. Look at the “label” line (1538 in this example) and copy the string in quotations. In my case, the label is “Unknown”.


7. Scroll down a bit to the “values” section to replace the coded value in the original field with the string copied in step 6. In this example, “0” is the code for “Unknown”, so you will paste “Unknown” where the 0 is on line 1567.

8. Repeat this process for all coded values in the layer file, and for all layers that need to be updated.

9. Once that is complete, use this new layer file to update each layer’s symbology.

If you find yourself in a situation where you need more control over the style of a layer but are concerned about losing thoughtfully-configured symbols, this method may be exactly what you are looking for. Reach out to GEO Jobe at connect@geo-jobe.com if you need assistance – we will be happy to work with you!


Want to read more on our recent articles? Check out these!

Christine

Solution Engineer / sUAS Pilot