0

I am trying to apply symbology to a raster layer via kernel density analysis. When I run the Python script below in ArcMap, I am get the error message below. I have searched and tried the common suggestions but none seem to work. Any help would be great.

Runtime error Traceback (most recent call last):   File "<string>", line 42, in <module>
File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\management.py", line 5722,
in ApplySymbologyFromLayer
raise e ExecuteError: Failed to execute. Parameters are not valid. 
ERROR 000732: Input Layer: Dataset C:\Users\cbriglia\Desktop\GIS\Python_Test\clip_raster 
does not exist or is not supported Failed to execute (ApplySymbologyFromLayer).


#____________________________________________________________________________________________________
# testpy.py
# Created on: 2014-02-24 15:34:03.00000
#   (generated by ArcGIS/ModelBuilder)
# Description: 
# ---------------------------------------------------------------------------

# Import arcpy module
import arcpy

# Check out any necessary licenses
arcpy.CheckOutExtension("spatial")


# Local variables:
Input_Table = "C:\\Users\\cbriglia\\Desktop\\GIS\\Shapefiles\\test.gdb\\test"
state_border_shp = "C:\\Users\\cbriglia\\Desktop\\GIS\\Shapefiles\\state_border.shp"
Python_Test = "C:\\Users\\cbriglia\\Desktop\\GIS\\Python_Test"
xy_layer = "C:\\Users\\cbriglia\\Desktop\\GIS\\Python_Test\\xy_layer"
xy_output_shp = "C:\\Users\\cbriglia\\Desktop\\GIS\\Python_Test\\xy_output.shp"
Hot_Spot_Output = "C:\\Users\\cbriglia\\Desktop\\GIS\\Python_Test\\hot_spot1"
Hot_Spot_Raster = "C:\\Users\\cbriglia\\Desktop\\GIS\\Python_Test\\clip_raster"
symbologyLayer = "C:\\Users\\cbriglia\\Desktop\\GIS\\Shapefiles\\HotSpotSymbology.lyr"


mxd=arcpy.mapping.MapDocument("CURRENT")

# Process: Make XY Event Layer
arcpy.MakeXYEventLayer_management(Input_Table, "longitude", "latitude", xy_layer, "GEOGCS['GCS_North_American_1983_CSRS',DATUM['D_North_American_1983_CSRS',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];-400 -400 1000000000;-100000 10000;-100000 10000;8.98315284119521E-09;0.001;0.001;IsHighPrecision", "")

# Process: Feature Class to Feature Class
arcpy.FeatureClassToFeatureClass_conversion(xy_layer, Python_Test, "xy_output.shp", "\"Time\" >= '0:00:00' AND \"Time\" <= '0:04:59'", "RowNumber \"RowNumber\" true true false 8 Double 0 0 ,First,#,,RowNumber,-1,-1;Date \"Date\" true true false 8 Date 0 0 ,First,#,,Date,-1,-1;Time \"Time\" true true false 255 Text 0 0 ,First,#,,Time,-1,-1;Day \"Day\" true true false 255 Text 0 0 ,First,#,,Day,-1,-1;Location \"Location\" true true false 255 Text 0 0 ,First,#,,Location,-1,-1;Actual_Cal \"Actual_Call_Type\" true true false 255 Text 0 0 ,First,#,,Actual_Call_Type,-1,-1;Sub_Type \"Sub_Type\" true true false 255 Text 0 0 ,First,#,,Sub_Type,-1,-1;Agency \"Agency\" true true false 255 Text 0 0 ,First,#,,Agency,-1,-1;District \"District\" true true false 255 Text 0 0 ,First,#,,District,-1,-1;Latitude \"Latitude\" true true false 8 Double 0 0 ,First,#,,Latitude,-1,-1;Longitude \"Longitude\" true true false 8 Double 0 0 ,First,#,,Longitude,-1,-1", "")

# Process: Kernel Density
arcpy.gp.KernelDensity_sa(xy_output_shp, "NONE", Hot_Spot_Output, "2.04744399999998E-03", "1.70620333333332E-02", "SQUARE_MAP_UNITS")

# Process: Clip
arcpy.Clip_management(Hot_Spot_Output, "-73.7275781441499 40.9867050023656 -71.7867901391991 42.0506901260974", Hot_Spot_Raster, state_border_shp, "-3.402823e+038", "ClippingGeometry")

# apply symbology
arcpy.ApplySymbologyFromLayer_management (Hot_Spot_Raster, symbologyLayer)
1

It seems that the ApplySymbologyFromLayer_management tool requires a raster layer as input while the script you have is specifying a raster dataset. Use the MakeRasterLayer_management tool to make a raster layer and first and then use that output as your input for the ApplySymbologyFromLayer_management tool.

  • This was the solution. – Chris Feb 26 '14 at 14:11
0

Here is a basic explanation on this error - This occurs even though the data clearly does exist on disk.

Cause Most often this is due to the input data path being entered incorrectly, as in the following situations:

• Misspelled folder names

• Using backslashes instead of forward slashes

• Having spaces in the path names

If the data clearly does exist, then the problem may be one of two known limits. See the Solution section for details.

Solution or Workaround Check the data path used, correct it as required and run the tool again.

If the data does exist, one of the following may be occurring:

If the input is a geodatabase feature class or table, an invalid subtype may exist on the dataset. To fix it, go to the feature class properties, then click the Subtypes tab and re-enter the default subtype code. If the default is zero (0), then click the cell with 0 and re-enter that same value. Apply the change by clicking the OK button. The dataset should now be usable. If the tool is being run on UNIX or Linux and the input is a text file that is being used as input to a tool with an input table parameter, such as CopyRows or MakeXYEventLayer, this is a known limit. On the Windows operating system the text file is represented as a table using a module,which is not available on UNIX or Linux. Change the data frame coordinate system to match the data being exported. If applicable, turn off live database connections at the layer level, and not just the subgroup. Turn off background processing. In ArcCatalog: Geoprocessing > Geoprocessing option > Clear Enable under Background Processing.

Your Answer

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

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