0

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", "", "")

enter image description here

enter image description here

enter image description here

  • can you share the code behind the model by exporting it to python? It would make it easier to help. – enolan Jul 31 '18 at 15:58
  • I added the python script, however I hear you cannot use the ArcGIS iterators in python. Is that true? – A. Coppi Jul 31 '18 at 16:58
  • That is true, but the iterator doesn't seem to be the issue here. – Bjorn Jul 31 '18 at 17:00
  • When running the model are there any messages on the results pane for geoprocessing? Reviewing the code, everything checks out with how the functions should be setup. I'm wondering if a warning is generated when the full model runs that could give out more facts. If you are not aware of how to add this pane, in ArcMap go to geoprocessing menu -> click results. Run the model and then expand the sessions for today. Let us know the outcome. – enolan Jul 31 '18 at 17:24
  • When I try to run the model it says "not exist within table Failed to execute (Polygon to Raster)". And there were no results in the geoprocessing pane (I checked recent and not completed). – A. Coppi Jul 31 '18 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.