Customer Service | Training | Contact Us
You are here: Home > User Forums > arcgis desktop discussion forums > Thread Replies

ArcGIS Desktop Discussion Forums

ArcGIS Desktop - Geoprocessing ModelBuilder forum

Using Eliminate from Data Management   Christopher J Nov 03, 2009
Report Inappropriate Content • Top • Print • Reply    
Subject Using Eliminate from Data Management 
Author Christopher J 
Date Nov 03, 2009 
Message Hello,

I have the attached model builder code that works fine until the Eliminate operation occurs.

Basically, I extract data from a raster image, get the slope, aggregate, reclassify and convert it to a polygon.

I then run an area calculation and create a feature layer. I want to use the selected features in this feature layer to eliminate features from the polygon.

The Modelbuilder will not let me connect the selected features to the Eliminate function. When I do, it connects but the box stays white. When I open the Eliminate operation, I get the x next to the input layer with a message . . .

The exported python code is below. The image of the model builder is attached.

My question is . . . how do I connect the data to the Eliminate function in ModelBuilder?

Thanks in advance.

"Input must be a polygon feature class" 
 
# ---------------------------------------------------------------------------
# test.py
# Created on: Tue Nov 03 2009 05:17:13 PM
#   (generated by ArcGIS/ModelBuilder)
# ---------------------------------------------------------------------------

# Import system modules
import sys, string, os, arcgisscripting

# Create the Geoprocessor object
gp = arcgisscripting.create()

# Set the necessary product code
gp.SetProduct("ArcInfo")

# Check out any necessary licenses
gp.CheckOutExtension("spatial")
gp.CheckOutExtension("3D")

# Load required toolboxes...
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Spatial Analyst Tools.tbx")
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Spatial Statistics Tools.tbx")
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Conversion Tools.tbx")
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/3D Analyst Tools.tbx")
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Analysis Tools.tbx")


# Local variables...
v3_9_shp = "F:\\temp\\chris\\ord\\allegheny_forest\\new\\data\\vector\\netl\\slopes\\demIntersect\\3_9\\3_9.shp"
extract = "F:\\temp\\chris\\ord\\allegheny_forest\\new\\data\\test\\modelTry\\extract"
Slope__3_ = "F:\\temp\\chris\\ord\\allegheny_forest\\new\\data\\test\\modelTry\\slope"
dem = "F:\\temp\\chris\\ord\\allegheny_forest\\new\\data\\raster\\jimDems\\dems\\ws74\\dem"
Filter__3_ = "F:\\temp\\chris\\ord\\allegheny_forest\\new\\data\\test\\modelTry\\filter"
Agg = "F:\\temp\\chris\\ord\\allegheny_forest\\new\\data\\test\\modelTry\\agg"
Reclass = "F:\\temp\\chris\\ord\\allegheny_forest\\new\\data\\test\\modelTry\\reclass"
Polygon_shp = "F:\\temp\\chris\\ord\\allegheny_forest\\new\\data\\test\\modelTry\\polygon.shp"
PolygonCalc_shp = "F:\\temp\\chris\\ord\\allegheny_forest\\new\\data\\test\\modelTry\\PolygonCalc.shp"
PolygonLayer = "F:\\temp\\chris\\ord\\allegheny_forest\\new\\data\\test\\modelTry\\PolygonLayer"
Eliminate_shp = "F:\\temp\\chris\\ord\\allegheny_forest\\new\\data\\test\\modelTry\\Eliminate.shp"
Eliminate_Intersect_shp = "F:\\temp\\chris\\ord\\allegheny_forest\\new\\data\\test\\modelTry\\Eliminate_Intersect.shp"
travel_route_join_SP_shp = "F:\\temp\\chris\\ord\\allegheny_forest\\new\\data\\vector\\anf\\travel_route\\mod\\travel_route_join_SP.shp"
PolygonLayer__2_ = "PolygonLayer"
PolygonLayer__3_ = "PolygonLayer"

# Process: Extract by Mask...
gp.ExtractByMask_sa(dem, v3_9_shp, extract)

# Process: Slope...
gp.Slope_3d(extract, Slope__3_, "DEGREE", "1")

# Process: Filter...
gp.Filter_sa(Slope__3_, Filter__3_, "LOW", "DATA")

# Process: Aggregate...
gp.Aggregate_sa(Filter__3_, Agg, "3", "MEAN", "EXPAND", "DATA")

# Process: Reclassify...
gp.Reclassify_sa(Agg, "VALUE", "0 5 5;5 10 10;10 15 15;15 25 25;25 50 50;50 75 75;75 100 100;100 300 500", Reclass, "DATA")

# Process: Raster to Polygon...
gp.RasterToPolygon_conversion(Reclass, Polygon_shp, "SIMPLIFY", "VALUE")

# Process: Calculate Areas...
gp.CalculateAreas_stats(Polygon_shp, PolygonCalc_shp)

# Process: Make Feature Layer...
gp.MakeFeatureLayer_management(PolygonCalc_shp, PolygonLayer, "\"F_AREA\" > 1014", "", "")

# Process: Make Feature Layer (2)...
gp.MakeFeatureLayer_management(PolygonLayer, PolygonLayer__3_, "", "", "")

# Process: Select Layer By Attribute...
gp.SelectLayerByAttribute_management(PolygonLayer__3_, "NEW_SELECTION", "\"F_AREA\" < 1014")

# Process: Eliminate...
gp.Eliminate_management(PolygonLayer__2_, Eliminate_shp, "LENGTH")

# Process: Intersect...
gp.Intersect_analysis("F:\\temp\\chris\\ord\\allegheny_forest\\new\\data\\test\\modelTry\\Eliminate.shp #;F:\\temp\\chris\\ord\\allegheny_forest\\new\\data\\vector\\anf\\travel_route\\mod\\travel_route_join_SP.shp #", Eliminate_Intersect_shp, "ALL", "", "INPUT")

 
  Export Graphic.jpg (opens in new window)