0

My university wants the maps we create to become more standardized and so we're changing all the colors on our base vector map.

The new standard needs to be indexed and I have the task of creating the spreadsheet/document that will help us in the future.

There are close to 100 layers that I need to index with, for example, the polygon layer name, fill color (rgb values), border color, and border width.

I have only recently started learning ArcPy so I was hoping there would be a GUI method I could follow and if not, what I should be looking for in an ArcPy script.

How does one extract this information?

  • 1
    This sounds like it might be a manual process. I don't believe arcpy has a way to extract the fill color, border color, or border width. Most likely you could get this information with ArcObjects, but someone else would have to confirm that. – ianbroad Jun 2 '15 at 15:43
  • Old VBA solutions at forums.esri.com/… and forums.esri.com/Thread.asp?c=93&f=1730&t=294885 and a similar question here at gis.stackexchange.com/questions/124401 Getting the border color and width is probably something else. And as ian mentioned, likely to involve ArcObjects. Also related/other workarounds gis.stackexchange.com/questions/114850 For documentation this approach is fine I guess, but please provide .lyr files or custom styles as well, because there's no easy way to apply symbology from tabular data. – Chris W Jun 2 '15 at 17:03
  • Would it be feasible for you to save lyr files which store all those things? You could open all your layers into an MXD with all the symbology set. Then, iterate through them and use arcpy.SaveToLayerFile_management – Fezter Jun 2 '15 at 23:11
1

There is a way but not an easy one, since it involves creating a service definition and reading XML files.

1) Using the arcpy function CreateMapSDDraft and StageService_server you can create a .sd file.

2) Unzip the “service name”.sd file.

3) Unzip the ..\v101\”service name”.msd file.

4) The file ..\layers\”layername”.xml holds the color codes (RGB/CMYK etc.) as seen below

So you can automate the whole process using python. enter image description here

0

I agree with comments by @ianbroad:

This sounds like it might be a manual process. I don't believe arcpy has a way to extract the fill color, border color, or border width. Most likely you could get this information with ArcObjects, but someone else would have to confirm that.

and @Fezter:

Would it be feasible for you to save lyr files which store all those things? You could open all your layers into an MXD with all the symbology set. Then, iterate through them and use arcpy.SaveToLayerFile_management

Personally, I would follow @Fezter's suggested method, which I have seen used very effectively at some sites I consult to.

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.