I have a series of georeferenced air photos that have black borders around them that I need to clip out. I also have a shapefile that has the outlines for each photo in it. The attributes contain the file name and the file path for each corresponding photo. I'm trying to build a model that will automatically select each feature in the shapefile, and clip the corresponding air photo (based on the filepath in the attribute table).
What I've got so far is a model that uses the Iterate Feature Selection to go through all the features. The problem is that I can only have it select the feature and use it as the clip features. I can't figure out a way to have it return the field with the filepath and use that as the input for the clip process.
Is this possible in ModelBuilder, or am I going to have to export it to Python (which I have almost no experience with) and set some variables? If my understanding of the iteration functions in ModelBuilder is correct, this may very well be impossible to do. I thought of doing a sub model that iterates through the filepath field for each selected feature, but that could be extremely time consuming.
You wrote: I can't figure out a way to have it return the field with the filepath and use that as the input for the clip process.
Is this a field in the shapefile with features you want to use to clip? This field value is a path to ___________? what?
If you are selecting a feature using feature selection iterator and want to get a field value try using the Get Field Value tool. This is a Model Only tool. You can find it from Model>Insert>Model Only>Get Field Value. This will return the field value. Then you can use the output variable of the Get Field Value tool as inline variable in the next tool (the tool you want to use the path (field value in)
Can you share a snapshot of your data, table and field that you want to get the value from? Also, How do you want to use this field value?
I added the Get Field Value tool as you suggested and I have a model that looks like it should work. However, when I run it, it seems to iterate through the features and then stops. It doesn't perform any of the processes that are supposed to occur after it selects the features. After I run it the Iterate Feature Selection will have the shadow behind it but none of the other processes do. I'm quite puzzled by this. My understanding is that it selects the first feature, performs the remaining functions, then goes to the next feature and so on. I've attached an image of the model I have right now and the table. The field I want to take the value from is the file path to the air photo that will be clipped. The file path will be the input for the Clip function and the selected feature will be the clip features.
Validate the entire model and save. Now try running. Do the tools run?
What field are you grouping your Iteration on? What is the value in group by ID? If empty it defaults to OID or FID.
Open your Get Field Value tool? Which field are you getting the value for. (Get field value only gets the first value of the field in a table). I assume it is the file path field, is it? What is the data type you are setting? I am assuming Feature Class.
Right click the Get Field Value tool and click Run. Does this tool run? double click on the output and check the value? Is the value correct?
Now right click the Clip tool and Run. Does the tool run?
Let me know if this helps. If not, share your model and sample of your data.