12

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 * ...


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 ...


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

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] + ...


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 ...


7

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

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

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

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

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

You need to put the model up to and including the collects value tool in its own model and expose the collects tool as a parameter. Then put that SUB model into a model and connect its output to your merge tool.


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

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

I believe you need only use the Merge Branch model only tool. As you can see in their figure the two branches feed into the merge branch tool resulting in a single output that continues the workflow. Looking at your example I'm not sure you need to use collect values as that returns a list so could never feed into your next sub-model as that takes a ...


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.


4

ModelBuilder has the ability to iterate different things. So, provided your table has a field with all the values you need, you could iterate over that field to get all the unique values. Alternatively, if you have a list of values, you could iterate Multivalue.


4

You need to iterate over feature classes in your input folder. To merge, you'll need to collect all the feature classes with collect values. You then pass the feature classes as the input for the merge tool. This merges all your feature classes into one. Next the area is calculated, then the table is exported to csv. I selected all the fields for the ...


3

I am thinking that you are getting "zero" values because your expression is multiplying the length field by the newly created, and ultimately blank (Null), W_%value% field. I think your expression needs to be: ( !ReLenCM! * %value%) This way you are actually multiplying by your iterator value and not a blank field. Also, use "Python" as your Expression ...


3

The following python code should help you calculate the distances from points to their corresponding median point. The script creates a new field in your point file and stores the distance to the median point. This script assumes that the point file and median point file have a common field that relates the points to the median points. If you generate the ...


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