arcpy apply symbology

03-13-2014 01:53 AM
New Contributor
Dear ArcGis community.
I mastered to write a little script that runs a naturalneighbor interpolation for several columns (hourly temperature measurements) in a shapefile. This works fine so far, but I want to apply symbology from a layer having classified intervals with 1 degree class breaks reaching from 0 to 35 degrees. I used arcpy.ApplySymbologyFromLayer_management("temperaturemap.tif", "symbollayer.lyr").
This also worked but the routine does not adopt the correct colors from the colorramp of the symbollayer. It always assigns the ends of the colorramp to the max and min value of the individual interpolation map. But when I do this manually in the layer properties -> symbology -> import symbology, it just works out fine.

# Import system modules
import arcpy
from arcpy import env
from import *

# Set environment settings
env.workspace = "S:/B5_2014"
inPointFeature = "S:/B5_2014/Temp_points.shp"
clipFeature = "S:/B5_2014/Messflaeche.shp"
symbol = "S:/B5_2014/temperatures.lyr"
outFolinWsp = "temperatures"
namesuppl = "temp"
#arcpy.MakeFeatureLayer_management(inPointFeature, "points")
# Set local variables
cellSize = 5

# Check out the ArcGIS Spatial Analyst extension license

# Execute NaturalNeighbor
for i in range(5):
num = i+1
zField = str(num)
outNatNbr = NaturalNeighbor(inPointFeature, zField, cellSize)
string1 = "S:/B5_2014/"+outFolinWsp+"/"+namesuppl+zField
string2 = outFolinWsp+"/"+namesuppl+zField
string3 = "S:/B5_2014/"+outFolinWsp+"/c"+namesuppl+zField+".tif"
arcpy.Clip_management(string2, "#", string3 ,clipFeature, "0", "ClippingGeometry")
arcpy.ApplySymbologyFromLayer_management("c"+namesuppl+zField+".tif", symbol)
Tags (2)
0 Kudos
0 Replies