4

Since arcpy is limited in how symbology can be manipulated, I was curious to know if a symbology layer can be stored in an arcpy add-in. Does anyone know if it is possible to store a .lyr file, or anything else for that matter, in a .esriaddin so that it can be used once the addin is installed?

5

Any file included in the Install\ directory of your add-in project will be carried along in the Python add-in when you run makeaddin.py. You can include layer files or anything else really. You'll find the absolute path to them on disk via

path_to_layer = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'mylayer.lyr')

in your whatever_addin.py to find them when they're installed. Once you've got that, you can use arcpy.mapping.UpdateLayer or arcpy.management.ApplySymbologyFromLayer as usual.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.