Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

This is related to the following Retain ESRI symbology in Mapinfo TAB . As an initial step (in arcpy) I want to access the symbology of all the datasets and create a document which has the details of the symbology as per the graphic below. enter image description here

Is this possible (should I invest the time to work it out) or if it isn't possible I will just have to get cracking on doing it manually on hundreds of MXD's (:-

To break down the steps -hopefully I can automate at least part of the process.

  1. scrolling through mxd's and getting the datasets that are on is no problem

    lyrFile = arcpy.mapping.Layer if lyrFile.visible == True:

  2. as it finds a dataset it should create a .lyr file (as most are just shp/gdb files) and then AttribXXX=lyrFile.xxx

where XXX and xxx are

BRIGHTNESS = lyrFile.brightness

(above format to following)

CONTRAST —contrast
DATASETNAME —datasetName
DATASOURCE —dataSource
DESCRIPTION —description
LABELCLASSES —labelClasses
LONGNAME —longName
NAME —name
SHOWLABELS —showLabels
TRANSPARENCY —transparency
WORKSPACEPATH —A layer's workspace or connection file path

The issue is I can't find anything that gets the RGB, line/point/polygon type, line weights, font etc. If these can be found then the next step

  1. write each of the values above to a CSV (easy)...for example (this has to be expanded)

                    f = open(origPath+'\\LayerAtrributes_LOG.txt', 'a')
                    f.write(str(DATASETNAME)+","+str(DATASOURCE)+","+str(DESCRIPTION)+","+str(MXDName)+"\n")
                    f.close()
    
  2. If possible a jpg of the symbology should be produced as in the example and the link to it added to the csv.

Am is asking to much of arcpy?

share|improve this question
    
This may be possible with ArcObjects but definitely not arcpy. –  blah238 Jun 20 '12 at 6:17
    
thanks. Can anyone assist with the arcobjects processing then? –  GeorgeC Jun 20 '12 at 6:27
    
Only can point you where to start: ArcObjects .NET SDK Help; Working with symbols and colors and Working with layers and renderers. If nothing else perhaps after reading through those you'll be able to define your requirements more precisely and limit the scope of work, because it will be a lot of work, I think. –  blah238 Jun 20 '12 at 6:39
    
Here's an old VB6 sample for exporting style symbols: Style Dump. Check StyleDump.bas for the meat of it. –  blah238 Jun 20 '12 at 7:01
add comment

2 Answers 2

up vote 2 down vote accepted

Basically this was not possible but figured out a roundabout way to get the result. See arcgis python script to tool issue for final result.

Other questions to get to this stage are

Is it possible to convert an ESRI style sheet to a font set?

Retain ESRI symbology in Mapinfo TAB

and

Create a summary table of the symbology of all datasets in multiple mxd's

share|improve this answer
add comment

I solved a similar problem by converting an MXD document to a MSD (which is just a zip file) so if you change the extension to ".zip" and open it you will find some .xml documents that contain alot of information about how each layer within the mxd is displayed. arcpy.ConvertToMSD There might be some work involed in getting the information you want but it should be in there somewhere. Hope that helps!

share|improve this answer
    
Thanks for this seminal idea. It is really helpful. The code generated in the xml is quite complex, did you program automatically capturing the relevant xml and if so can you share it, if not I will start working on this aspect. –  GeorgeC Jun 29 '12 at 1:09
    
I was only interested in two values in the xml so anything I had will be very hard to build on. But there are heaps of really good python xml tutorials out there so if you are prepared to spend some time reading I'm sure you will solve the problem. Happy coding :) –  dango Jun 29 '12 at 6:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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