3

I'm trying to build a model using Model Builder in ArcGIS 10.1 that starts off by joining two shapefiles together based on a common field. I would like to make this open ended (not hardcoded) so I can use it repeatedly.

enter image description here

Problem is when I go to select my shapefiles when I run it, I can add one, but not both (I only get an option to select "data elements").

Likewise, when I try to edit the model and insert or hardcode the shapefiles into it, I get an error message at Add Join that says

ERROR 000840
The value is not a Raster Layer. ERROR 000840: The value is not a Raster Catalog Layer. ERROR 000840: The value is not a Mosaic Layer.

When I go through this same workflow in ArcMap I get the results I am looking for.

Any idea what is causing these errors, how to correct them or a work around?

So we are clear, the following workflow is what I'm trying to automate:

1.  Join [CURRENTMONTH] shapefile to [PREVIOUSMONTH] shapefile.
2.  Perform a select by attributes:
    a.  Select From “[PREVIOUSMONTH]_[CURRENTMONTH]“ WHERE “[CURRENTMONTH].SEGMENT_ID” IS NULL
3.  Remove Join.
4.  Export Selected Features to new shapefile (deletes.shp)

The second half of the model reverses the process and attempts to accomplish the following:

1.  Join [PREVIOUSMONTH] shapefile to [CURRENTMONTH] shapefile.
2.  Perform a select by attributes:
    a.  Select From “[CURRENTMONTH]_[PREVIOUSMONTH]” WHERE  “[PREVIOUSMONTH].SEGMENT_ID” IS NULL
3.  Remove Join.
4.  Export Selected Features to new shapefile (added.shp)

UPDATED TO SHOW MODEL DIALOG

enter image description here

Updated to show new model enter image description here

1 Answer 1

11

To do a join in a model, you first need to convert the shapefiles to feature layers within the model. Use the Make Feature Layer tool in the Data Management Tools>Layers and Table Views toolbox on your input shapefiles, then add the outputs of the Make feature layer tools as the inputs to the Join tool. The select by attributes tool also requires that the inputs be feature layers.enter image description here

EDIT

Here is an update in reference to comments below. Craig, since you want to run this as a tool, you need to set the model parameters on the tools without adding any data in the model itself. So starting with a empty model, add your make feature layer and join tools. Right click on the Make Feature Layer tool, then go to Make Variable>From Parameter>Input Features. Repeat for your second Make Feature Layer tool. Add the output layers to the join tool, then right-click on the join tool and go to Make Variable>From Parameter>Input Join, then repeat an do output join. Since you are going to run this a tool you will need to specify the join fields. Here are some screenshots.

enter image description here

When you run this model as a tool the select input layer shows shapefiles.

6
  • I have added the Make Feature Layer tool to each shapefile and my new model looks like your example above. However, when I go to run the tool, I am not given any of my shapefiles to choose from. Instead it just gives me a "show of type: Data Elements". I have added a screen grab to show my issue.
    – Craig
    Commented Apr 4, 2013 at 12:38
  • Please post a graphic of your new model with the make feature layer tools added, that may help narrow down your issue.
    – Zachary
    Commented Apr 4, 2013 at 12:51
  • I've updated to show a picture. I stripped out the second part to help focus on the join issue.
    – Craig
    Commented Apr 4, 2013 at 13:01
  • Craig, see my edits in my original post.
    – Zachary
    Commented Apr 4, 2013 at 13:31
  • great input. thanks for your help! works beautifully now.
    – Craig
    Commented Apr 4, 2013 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.