I am trying to load a TIF file to the mxd using arcpy, then add a definition file to map colouring.

For one layer I have the problem, that the amount of values will always be different, sometimes it will be 0,1,2,3,4,5,6 sometimes it will be 0,7,8 and sometimes it will be 0,1,2,3,4,5,6,7,8,9,10,...,34

So i created in ArcMap an empty layer definition file: BEST_SERV_MO99.lyr when added the TIF layer to the mxd, I am applying this. Now I would like to add all values except 0... Also I would like to set the alpha to be 50%.

when I try the following code:

outRaster = os.path.join(path_now, tif_file)
addLayer = arcpy.mapping.Layer(outRaster)
self.log("addLayer: "+ addLayer.name)
arcpy.mapping.AddLayerToGroup(self.df, targetGroupLayer, addLayer, "BOTTOM")
layers = arcpy.mapping.ListLayers(self.mxd)
for layer in layers:
   if layer.name == tif_file:
       layer.name = tif2_file
       if os.path.isfile(symbologyLayer):
           self.log("layer: "+layer.name+" - symbologyType: "+layer.symbologyType)

I am always getting symbologyType: OTHER The problem is, with OTHER, I can not add all values like this:

if layer.symbologyType == "UNIQUE_VALUES":

also I have tried to do according this:

arcpy.mapping.UpdateLayer(df, updateLayer, sourceLayer, True)

but this did not have any effect, layer.symbologyType was still OTHER.

I am using ArcGIS for Desktop 10.3 with Python 2.7

  • Please edit the question to specify the version of ArcGIS in use. – Vince Apr 1 '16 at 13:26
  • edited my question, see above: ArcGIS for Desktop 10.3 with Python 2.7 – schurtertom Apr 1 '16 at 21:24
  • No one has a solution, how I can dynamically add all values? – schurtertom Apr 13 '16 at 9:01

Your Answer

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

Browse other questions tagged or ask your own question.