krausinger

Integrate Tool in Python

Discussion created by krausinger on Sep 3, 2012
Latest reply on Sep 9, 2012 by krausinger
Hi,

I'm trying to use the Integrate Tool in python (stand-alone script). I always get an Error message... I already tried to run the script different ways...no success

# Import arcpy modules
import arcpy
from arcpy import env

# Set workspace for Input and Output Data
env.workspace = "C:/Users/kraus-b/Desktop/polygon generalisation"

# Define Input and Output Files
soilclass = "C:/Users/kraus-b/Desktop/polygon generalisation/Input/soilclass.shp"
integrateFeatures = "C:/Users/kraus-b/Desktop/polygon generalisation/output/soilclass_copy.shp"

# CopyFeature (input, output)
arcpy.CopyFeatures_management(soilclass, integrateFeatures)
 
# Execute Integrate
arcpy.Integrate_management(integrateFeatures, "3 Meters")


Traceback (most recent call last):
  File "C:\Users\kraus-b\Desktop\forum.py", line 28, in <module>
    arcpy.Integrate_management(integrateFeatures, "3 Meters")
  File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\management.py", line 1702, in Integrate
    raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000735: Input Features: Value is required
Failed to execute (Integrate).



I tried to use the  Integrate Tool in the Python Shell in ArcMap... it works.

I also tried to export the Integrate Script from the Modelbuilder to Python. It works in the Modelbuilder but not as a stand-alone script. When I export the Script, it makes a # after the Input. It stands for the rank of feature classes if there are more than one input feature class.

The exported script from Modelbuilder:
# Import arcpy module
import arcpy

# Local variables:
soilclass_copy = "soilclass_copy"

# Process: Integrate
arcpy.Integrate_management("soilclass_copy #", "3 Meters")


I also tried following code
arcpy.Integrate_management("C:/Users/kraus-b/Desktop/polygon generalisation/output/soilclass_copy.shp #", "3 Meters")


--> same ERROR message

I also tried to copy the code from the example in the Desktop Help - no success

I'm not a python expert but usually I'm able to use simple gis tools in python. In this case I'm helpless.
Any Ideas?

Thanks in advance
Benjamin

Outcomes