How do you update the layer symbology (styles) in table of contents automatically?

2875
6
Jump to solution
09-14-2015 02:49 PM
MarkPachlhofer1
New Contributor

Hi, I'm trying to create a layer package using the 'Schema Only' option. Everytime I go to run the tool, however, I keep getting ERROR 001280: "For Schema only packages, the input datasets cannot be located in different workspaces.". I've checked the two feature classes that I'm using and they are both located in the same personal geodatabase (.mdb) file under the same feature dataset. I'm not sure what I might be doing wrong. I'd appreciate any help that might give me clue as to the problem.

I've attached the data that I'm working with, which doesn't have any features currently drawn because I was just testing to see if I could create a layer package successfully to automatically update my element symbology.

What I'm actually trying to do is update the symbology in my table of contents automatically after the data is added. I thought that a layer package using the 'schema only' option would be my best bet, but if anyone has links to or knows of a script (Python, VB, etc...) that can do that same thing I'd be willing to try that.

Thanks in advance, Mark

0 Kudos
1 Solution

Accepted Solutions
FreddieGibson
Occasional Contributor III

I wouldn't try to create packages if I only needed the symbology. I would think that you'd need to create a series of layer files that will contain the needed symbology. You'd also need to build an application extension that listens for when data is added to the TOC. When the data is added you'd need to review the name of the layer and if it matches your chosen name you when then either call the ApplySymbologyFromLayer tool or use the layer object to update the layers symbology with the needed layer file. Does that make sense?

View solution in original post

6 Replies
FreddieGibson
Occasional Contributor III

Did you find a solution for this?

0 Kudos
MarkPachlhofer1
New Contributor

Hi Freddie,

No, I did not.

Mark

0 Kudos
FreddieGibson
Occasional Contributor III

Are you trying to change the symbology of data that is added based on the name of the data added? Or are you provided a user with specific data and you want these particular classes to be symbolized a particular way?

0 Kudos
MarkPachlhofer1
New Contributor

I'm trying to change the symbology of the data that is added based on the name of the added data. I thought that creating a layer package with the schema only would do something similar, but I couldn't create the package because of the aforementioned error that I encountered to test it.

0 Kudos
FreddieGibson
Occasional Contributor III

I wouldn't try to create packages if I only needed the symbology. I would think that you'd need to create a series of layer files that will contain the needed symbology. You'd also need to build an application extension that listens for when data is added to the TOC. When the data is added you'd need to review the name of the layer and if it matches your chosen name you when then either call the ApplySymbologyFromLayer tool or use the layer object to update the layers symbology with the needed layer file. Does that make sense?

MarkPachlhofer1
New Contributor

Yes, it does and that's what I was afraid of unfortunately. I haven't coded in a long time so that might take a while to figure out. Thank you for your help though.

Mark

0 Kudos