I have a process in which I need to use coverages. I can create the coverages just fine using FeatureClassToCoverage_conversion within arcpy but trying to union 2 coverages together does not work in arcpy with the identified method "Union_arc". I suspect it has something to do with creating an ArcINFO workspace, but I do not know how to use this for _arc commands.
The error is "Object: Tool or environment not found" I have ArcINFO installed and can run these tools successfully in Modelbuilder. I have attached a test script to get Union working. Running 10.1 ArcGIS python 2.7.
import arcpy, os, sys
from arcpy import env
print 'Starting....'
env.OverWriteOutput = True
arcpy.SetProduct("ArcInfo")
env.workspace = "G:\\Projects\\P747\3円_Landbase\\LB1\\temp\\test2\\"
TEMP = "\\\\silver\\clients\\Projects\\P747\3円_Landbase\\LB1\\TEMP\\"
print 'Loaded Data....'
if arcpy.Exists(TEMP + "airworkspace3"):
arcpy.Delete_management(TEMP + "airworkspace3")
arcpy.CreateArcInfoWorkspace_management(TEMP, "airworkspace3")
r = str(1)
for fc in arcpy.ListFeatureClasses():
print 'Working on ' + fc
CovName = TEMP + "airworkspace3\\" + "Layer1"
CovName3 = TEMP + "airworkspace3\\" + "Success"
if arcpy.Exists(CovName + str(r)):
arcpy.Delete_management(CovName + str(r))
arcpy.FeatureclassToCoverage_conversion(fc + " POLYGON", CovName + r, "", "DOUBLE")
r += str(1)
print 'Working on Union'
arcpy.Union_arc(CovName + "1", CovName2+ "2", CovName3)
print 'Completed ' + fc + ' processing....'
-
what is the error message?mwil– mwil2015年01月16日 21:23:23 +00:00Commented Jan 16, 2015 at 21:23
-
can you run the tools and then use Geoprocessing>Results>CopyAsPythonSnippet to help with the code?mwil– mwil2015年01月16日 21:24:56 +00:00Commented Jan 16, 2015 at 21:24
-
That is what I have done and the tools are not recognized by arcpyD_C– D_C2015年01月16日 21:30:55 +00:00Commented Jan 16, 2015 at 21:30
-
stand alone or in the python window?mwil– mwil2015年01月16日 21:33:18 +00:00Commented Jan 16, 2015 at 21:33
-
1Would you be able to edit your question to include a code snippet that can be used by someone with an Advanced level license to see precisely where you are stuck, please?PolyGeo– PolyGeo ♦2015年01月17日 02:50:44 +00:00Commented Jan 17, 2015 at 2:50
1 Answer 1
After much fanfare, I found this to work. Seems really strange to have to re-name an alias, but it worked.
import arcinfo, arcpy, os, sys
from arcpy import env
arcpy.SetProduct("ArcInfo")
tbx = arcpy.ImportToolbox(r"C:\Program Files (x86)\ArcGIS\Desktop10.1\ArcToolbox\Toolboxes\Coverage Tools.tbx", "newalias")
print arcpy.Usage("union_newalias")
arcpy.Union_newalias(CovName1, CovName2, CovName3)
Explore related questions
See similar questions with these tags.