I am using ModleBuilder within AcrGIS and am trying to create a modle that will:
1) Take my polygon layer and create an inverted buffer (using a negative value)
2) Add a field to the new polygon layer
3) Take that polygon layer and turn it into a raster
4) Take the raster and convert it to points
5) Add a field to the points layer
6) Use the spatial join tool to combine the attributes into one layer and table
I have made a model that encompasses all of the tools and analysis, but it has failed to run. It keeps reporting that it cannot complete the rater to point portion of the model. I have tried making two separate tools (one for the buffer, and another tool to create the points), and they ran without any problems. However that requires me to add the inverted polygon to the points model separately. It appears to only be an issue when the two are put together.
Am I doing something wrong, or is there a way for me to combine two separate models into one model?
The first image is the model with all of the components in it. The second image is of just the buffer model, and the third image is of creating the points.
Here is the code for the whole model I have built this far:
import arcpy
# Load required toolboxes
arcpy.ImportToolbox("Model Functions")
# Local variables:
B_mdb = "C:\\Users\\Desktop\\temp\\ModelBuilder\\B.mdb"
Name = "B"
B = "C:\\Users\\Desktop\\temp\\ModelBuilder\\B.mdb\\B"
inverted_buff_shp = "C:\\Users\\Desktop\\temp\\ModelBuilder\\inverted_buff.shp"
inverted_buff_shp__2_ = inverted_buff_shp
bark_cells_tif = "C:\\Users\\Desktop\\temp\\ModelBuilder\\bark_cells.tif"
bark_points_shp = "C:\\Users\\Desktop\\temp\\ModelBuilder\\bark_points.shp"
bark_points_shp__2_ = bark_points_shp
inverted_buff_SpatialJoin = "C:\\Users\\Documents\\ArcGIS\\Default.gdb\\inverted_buff_SpatialJoin"
# Process: Iterate Feature Classes
arcpy.IterateFeatureClasses_mb(B_mdb, "", "", "NOT_RECURSIVE")
# Process: Buffer
arcpy.Buffer_analysis(B, inverted_buff_shp, "-0.35 Meters", "FULL", "ROUND", "NONE", "", "PLANAR")
# Process: Add Field (2)
arcpy.AddField_management(inverted_buff_shp, "model", "TEXT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
# Process: Polygon to Raster
arcpy.PolygonToRaster_conversion(inverted_buff_shp, "OBJECTID", bark_cells_tif, "CELL_CENTER", "NONE", "2")
# Process: Raster to Point
arcpy.RasterToPoint_conversion(bark_cells_tif, bark_points_shp, "Value")
# Process: Add Field
arcpy.AddField_management(bark_points_shp, "orient", "DOUBLE", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
# Process: Spatial Join
arcpy.SpatialJoin_analysis(inverted_buff_shp__2_, bark_points_shp__2_, inverted_buff_SpatialJoin, "JOIN_ONE_TO_ONE", "KEEP_ALL", "orient \"orient\" true true false 0 Double 0 0 ,First,#,C:\\Users\\Desktop\\temp\\ModelBuilder\\bark_points.shp,orient,-1,-1;NO_NAME \"NO_NAME\" true true false 19 Double 0 0 ,First,#,C:\\Users\\Desktop\\temp\\ModelBuilder\\inverted_buff.shp,NO_NAME,-1,-1;Shape_Leng \"Shape_Leng\" true true false 19 Double 0 0 ,First,#,C:\\Users\\Desktop\\temp\\ModelBuilder\\inverted_buff.shp,Shape_Leng,-1,-1;Shape_Area \"Shape_Area\" true true false 19 Double 0 0 ,First,#,C:\\Users\\Desktop\\temp\\ModelBuilder\\inverted_buff.shp,Shape_Area,-1,-1;BUFF_DIST \"BUFF_DIST\" true true false 19 Double 0 0 ,First,#,C:\\Users\\Desktop\\temp\\ModelBuilder\\inverted_buff.shp,BUFF_DIST,-1,-1;ORIG_FID \"ORIG_FID\" true true false 10 Long 0 10 ,First,#,C:\\Users\\Desktop\\temp\\ModelBuilder\\inverted_buff.shp,ORIG_FID,-1,-1;model \"model\" true true false 254 Text 0 0 ,First,#,C:\\Users\\Desktop\\temp\\ModelBuilder\\inverted_buff.shp,model,-1,-1", "INTERSECT", "", "")