An errror in Intersecting process

310
0
01-30-2019 03:47 AM
SOMNATHBAR
New Contributor

I want to process some raster layers through Raster to point, intersect with the generated point layers, dissolve intersected layer and lastly table to excel.

I am getting an error in when in intersecting process.

This is the error.......

Traceback (most recent call last):
File "C:\Users\Lrm\Desktop\Pyy.py", line 44, in <module>
b = arcpy.Intersect_analysis("i 0;taluk 1", inMemInt, "ALL", "", "INPUT")
File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\analysis.py", line 289, in Intersect
raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input Features: Dataset i 0;taluk 1 does not exist or is not supported
Failed to execute (Intersect).

Below I have pasted the code and also attached in py formate.

Please look into the issue. 

import arcpy,os
from arcpy import env
from arcpy.sa import *
arcpy.env.overwriteOutput= 1
arcpy.CheckOutExtension("Spatial")
env.workspace = "E:\\PhD.Progress_1\\climatic data\\Pre\\All"
# Local variables:
Taluk = "E:\\PhD.Progress_1\\UK_HP_SKM\\UK_HP_Taluk.shp"
print Taluk

Rfiles=arcpy.ListRasters('*', 'tif')
print Rfiles
for cl in Rfiles:
 print cl
 print("processing2:"+cl)
 fileroot1= cl[0:(len(cl)-3)]
# Process: Raster to Point
 points = "in_memory/Points" + fileroot1
 a = arcpy.RasterToPoint_conversion(cl, points, "Value")
print "''''''''''''''Point'''''''''''Done'''''''''''''''''''''''''''"
 print arcpy.GetMessages ()
for i in a:
 print i
 print("processing3:"+i)
 fileroot2= i[0:(len(i)-3)]
 #Taluk = "E:\\PhD.Progress_1\\UK_HP_SKM\\UK_HP_Taluk.shp"
 taluk = r"E:/PhD.Progress_1/UK_HP_SKM/taluk.shp"
 print taluk
 inMemInt = "in_memory/Intersect" + fileroot2
 # Process: Intersect
 b = arcpy.Intersect_analysis("i 0;taluk 1", inMemInt, "ALL", "", "INPUT")
print "'''''''''''''''Ins'''''''''''Done'''''''''''''''''''''''''''"
 print arcpy.GetMessages ()
for j in b:
 print j
 print("processing4:"+j)
 fileroot3= j[0:(len(j)-3)]
 dis = "in_memory/dis" + fileroot3
# Process: Dissolve
 c = arcpy.Dissolve_management(j, dis, "NAME_3", "GRID_CODE MEAN", "MULTI_PART", "DISSOLVE_LINES")
print "'''''''''''''''Dis'''''''''''Done'''''''''''''''''''''''''''"
 print arcpy.GetMessages ()
 for k in c:
 print k
 print ("processing5:" + k)
 outdir4 = 'E:\\PhD.Progress_1\\climatic data\\Pre\\Xl_Taluk\\'
 pli_save = outdir + fileroot4 +'xls'
 arcpy.TableToExcel_conversion(k, pli_save)
print "'''''''''''''''XL'''''''''''Done'''''''''''''''''''''''''''"
 print arcpy.GetMessages ()

print "'''''''''''''''All Has Done'''''''''''Done'''''''''''''''''''''''''''"
print arcpy.GetMessages ()
0 Kudos
0 Replies