12

The way I would set your task up would be to create a custom script which provides greater flexibility than the modeler but can still provide a similar interface to its users. You can create one from: Processing Toolbox > Scripts > Tools > Create new script Then copy/paste the script below and save it into C:/Users/You/.qgis2/processing/scripts. The ...


10

The easiest solution is to replace the raster calculator with the "Plus" operator in the iterator. EDIT: note that I wasn't able to reproduce the problem in ArcGIS 10.6: ("%Raster%") + 1 worked fine in my iterator ( with output =, for example, %Raster%_out ) Anyway, the best solution is to use a Python script import arcpy from arcpy.sa import * ...


9

To answer your specific question "How to iterate through layers of an MXD?" mxd = arcpy.mapping.MapDocument("CURRENT") # Uses your currently open MXD df = arcpy.mapping.ListDataFrames(mxd, '')[0] # Chooses the first dataframe for lyr in arcpy.mapping.ListLayers(mxd, '', df): # Loop through layers # Any tools you want to run on each layer go here ...


8

I believe you will need to build a small Python script and paste that into your Model. You would use the ArcPy module and build a field list on your layer: fieldList = arcpy.ListFields("C:/Data/MyGIS.gdb/MyLayer") and then you would iterate through the fieldList using a for loop, for example for field in fieldList: #run your spatial analysis ...


8

Slicing should do the trick. To slice a string do this "%var%"[x:y], where x and y are indices representing the start and end positions of the bits of the string you want to keep. The first character of a string has index 0. say you got: var = "myfc_clip" and you want myfc_buffer not myfc_clip_buffer you would do something like this "%var%"[0:5] + ...


6

Use the Calculate Value tool in model builder to drop the last 4 four characters of your Count_Field variable. Set the tool to be a precondition to the alter field tool to ensure it executes first. Set your expression as shown below


5

One solution is to use the iterations portion as a completed model, then use that model inside of another that performs the remaining operations on the output of the iteration model. This is called a nested model. Also, consider looking into Python scripting, the options for dropping into and out of iterations are much more flexible.


5

Nest the iterated part in a sub-model. See the "Advanced Use of Model Iterators" section under Integrating a model within a model in the help. Related question: Exporting data from Collect Values output in ArcGIS ModelBuilder?


5

@Geoist is right. You'll have much more control over this using Python -- you can nest as many loops as you damn well please. Pseudo Code: Create a search cursor Loop through each record with a for loop Compose a whereClause using the ObjectID (unique identifier) Make feature layer Select by location etc. (delete feature layer to end the loop) Code ...


5

You could use the Append tool to add your intersect_result to a feature class. First, I would create an empty feature class to store your outputs in, then just add the append tool to your model after your Intersect completes. Make the empty feature class the Target dataset and the intersect_result the input dataset. You can save yourself some trouble ...


5

Export your table to a text format. Grab the header row and paste it to a new file. Delete irrelevant column headings (could also turn them off prior to export to avoid this step), and then use find/replace functions to change the delimiting characters to proper syntax for the formula (ie quotes around field names, a plus sign in the middle). Copy and paste ...


5

Python is case sensitive, you have a lower case "p" in both the points and polygon variable names, but reference those two variables in your code with a capital "P". The code fails b/c it is trying to reference variables that do not exist within the cursor and join statements. With you update an additional error msg I see couple more issues: The first two ...


4

Two iterators are allowed within a model as long as you embed a model within a model. Check out the advanced use of model iterators section on the integrating a model within a model help page.


4

The input of the While loop should be of boolean data type. I recreated your model and script and called arcpy.SetParameterAsText(1, "FALSE") in the script. For the script output, I used a boolean. ModelBuilder automatically converts the output string "FALSE" to boolean false. The boolean false can be evaluated by the While loop.


4

In the sub model, insert "Collect Values" after the iterator. You find it in the model builder menu "Insert" -> "Model Only Tools"


4

I like to run such things from a file geodatabase to keep all the fields consistent for field mapping in your model. If I interpreted correctly you want to: 1. split your FC by lease type. 2. Dissolve each resulting FC on the lease type and sum the percent interest for that lease type. 3. and then combined all FC's back together. From what I have gathered, ...


4

Assuming that your text files are some sort of tables (e.g. CSV having X and Y coordinates in rows with delimited columns), try using 'Iterate Tables' instead of 'Iterate Files'. You will be offered an option of choosing DBF or INFO as the type. Ignore this field. It is optional. You should now be able to connect the output file to the 'Make XY Event ...


4

The ArcGIS help page for iterators in model builder says that you can only have one iterator per model. (It's the first note, below the table of iterator types.) Perhaps that is why you are having trouble trying to use two in the same model. I believe if you want to use multiple iterators in modelbuilder you have to build a model for each one and then nest ...


4

If you try to output the iterate raster tool directly into raster calculator, you will only see the last iteration in the raster calculator layers and variables list. To get around this nuisance in model builder, use Collect Values to generate a list that you can pass off to Cell Statistics to do your calculations. Simply choose the "MEAN" overlay ...


4

You need to feed the output of the iterator (green blob) into a make featurelayer tool which would then feed into your selectbyattribute tool.


4

I'm not sure how to manage your changing neighborhood size, but here is already an answer. Iterate Rasters runs the same tool/chain of tools for a series of datasets in the specified workspace, so it's not going to do what you need. If you want to reuse the output of the model as input a number of times, you should do the following: Right-click the input ...


4

I usually approach situations like this using a few steps. The general process is to determine the maximum value in each polygon and then determine which points actually has that value: First join a unique identifier from the polygons to the points (Using intersect, spatial join, etc..). This doesn't have to be OBJECTID, but it can be. Then run summary ...


4

I hate to be the bringer of bad news, but your current workflow is probably an inefficient way of reaching your goal. What you should check out is the Spatial Join Tool http://resources.arcgis.com/en/help/main/10.1/index.html#//00080000000q000000. It should do, I think, everything you are asking to accomplish if you set up the options right. You'll just ...


4

I was able to get this to work by: Specifying that Workspace is a Precondition to Create File GDB Using %Name%\%Name% as the File GDB Name, not as part of the location This results in the desired output:


4

I am not sure if it matters to keep the current file structure the way it sits. However, if you do not need to maintain file schema integrity you could get away with creating a stand-alone variable and setting it to your workspace (e.g. C:\0207000_test). - Rename the "Any Value" to "%Data Workspace%" Then use the Create Folder function and set the ...


4

The model you want is below: You want to be using the Feature Selection iterator not the Row iterator. You set that up using the ID field as the case field. This is what becomes Value and this is what you use with in-line substitution in the field calculate tool. But you should heed @Baltok's warning as if you have overlapping buffers then that will ...


4

I would use another approach, without while loop but iterating over the unique values for which you want to calculate a sum: import arcpy fc = r"D:\Auto_Logit\Neartable.gdb\SP_15km_sewage" ## first get a list of unique IN_FID values fid_list = sorted({row[0] for row in arcpy.da.SearchCursor(fc, "IN_FID")}) ## then iterate over these IN_FID values: for ...


4

Export one row of your table and use that in your model, or, instead of iterating over that original table, use a selection tool.


4

Put a definition query on the table where ObjectID < 1, then with the table open, run the model.


4

You can use the Iterate Feature Classes tool within ModelBuilder. This will iterate through your feature classes as long as they are all within the same workspace. It is a ModelBuilder only tool that can be accessed through the menu within ModelBuilder.


Only top voted, non community-wiki answers of a minimum length are eligible