Symbology change for feature class and raster

2011
1
Jump to solution
06-12-2013 07:42 PM
CPoynter
Occasional Contributor III
Hi All,

I am developing a script to load layers into a dataframe for exporting to make thumbnails.

I would like rasters to appear in RGB symbology and feature classes a neutral grey colour.

How do I code so when each data type loads, it will default to my two preferred symbology options?

Regards,

Craig
0 Kudos
1 Solution

Accepted Solutions
CPoynter
Occasional Contributor III
Hi,

Although not using RGB for all rasters and a neutral grey for feature classes, I was able to solve my symbology issue.


                    desc = arcpy.Describe(data)                      mxd_new = arcpy.mapping.MapDocument(mxd_out)                      df = arcpy.mapping.ListDataFrames(mxd_new, '*')[0]                      try:                              lyrFile = arcpy.mapping.Layer(data)                              if desc.dataType == 'RasterDataset':                                 layerType = arcpy.management.MakeRasterLayer                                  result = layerType(lyrFile, 'temp_layer')                                 layer_object = result.getOutput(0)                                 arcpy.mapping.AddLayer(df, layer_object)                              else:                                 result = arcpy.management.MakeFeatureLayer(lyrFile, 'temp_layer')                                 layer_object = result.getOutput(0)                                 arcpy.mapping.AddLayer(df, layer_object) 


This is the key to changing the symbology and adding it to the dataframe before exporting to thumbnail format.

Regards,

Craig

View solution in original post

0 Kudos
1 Reply
CPoynter
Occasional Contributor III
Hi,

Although not using RGB for all rasters and a neutral grey for feature classes, I was able to solve my symbology issue.


                    desc = arcpy.Describe(data)                      mxd_new = arcpy.mapping.MapDocument(mxd_out)                      df = arcpy.mapping.ListDataFrames(mxd_new, '*')[0]                      try:                              lyrFile = arcpy.mapping.Layer(data)                              if desc.dataType == 'RasterDataset':                                 layerType = arcpy.management.MakeRasterLayer                                  result = layerType(lyrFile, 'temp_layer')                                 layer_object = result.getOutput(0)                                 arcpy.mapping.AddLayer(df, layer_object)                              else:                                 result = arcpy.management.MakeFeatureLayer(lyrFile, 'temp_layer')                                 layer_object = result.getOutput(0)                                 arcpy.mapping.AddLayer(df, layer_object) 


This is the key to changing the symbology and adding it to the dataframe before exporting to thumbnail format.

Regards,

Craig
0 Kudos