[GIS] Export ArcMap Symbology to table, text or other format
arcgis-desktopconvertsymbology
In ArcMap how can I export a symbology style to table or text format such as .csv?
Best Answer
I found a kludge courtesy of Sephe Foxon GeoNet, extract the definition from a legend graphic:
add a legend to your map document containing only that layer. Then,
right click on the legend and convert to graphics. You will have to
ungroup the legend and also each of the symbology types, but then you
can select the boxes with just the text, by dragging a rectangle
around all of them, and copy. You can then paste them as text into
Excel, and each will be on a new row.
After you have everything in rows use Excel's "Data >> Text to Columns >> Delimiter '('" to split Label (value) into separate fields and then Search & Replace ) with nothing.
It works but is cumbersome and not what I'd call a solution. Still if you're in bind this might let you keep going.
Another approach is mine the map's Service Definition Draft (File >> Share as service >> Save as service definition file >> Choose 'No connection') , unzip the archive, locate the .msd file, unzip that, find layer_name.xml, then in Excel Open as XML Table and scan for columns FieldName, String, Label.
You can override how delimited text files are displayed within ArcGIS
by using the schema.ini files. An example of when you would want to
use the schema.ini file to override the default behavior is when
ArcGIS is misinterpreting a field type. The following example shows
how to do this for a field called PLOTS which should be displayed as
type Text but is being interpreted as type Double.
[Trees.CSV]
Col14=PLOTS Text
Note that you may need to create a schema.ini file if one is not
present and you need to override how delimited text files are
displayed in ArcGIS. For more information on the schema.ini file, do a
search for schema.ini on the Microsoft MSDN website.
Best Answer
I found a kludge courtesy of Sephe Fox on GeoNet, extract the definition from a legend graphic:
After you have everything in rows use Excel's "Data >> Text to Columns >> Delimiter '
(
'" to splitLabel (value)
into separate fields and then Search & Replace)
with nothing.It works but is cumbersome and not what I'd call a solution. Still if you're in bind this might let you keep going.
Another approach is mine the map's Service Definition Draft (File >> Share as service >> Save as service definition file >> Choose 'No connection') , unzip the archive, locate the
.msd
file, unzip that, findlayer_name.xml
, then in Excel Open as XML Table and scan for columnsFieldName, String, Label
.(Note the RGB columns which might be useful for the related Saving a ArcMap layers RGB values into the attribute table question.)
There is an arcpy snippet in Getting layers from .msd using ArcPy? for getting to the layer file, and a more fully developed script at Using ArcPy to get layer symbology?. I've lost track of the original Q/A that led me to the idea of using a service definition.