12
votes
Accepted
Raster Calculator Iteration in ModelBuilder?
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
...
12
votes
Accepted
Simplify repetitive tasks in QGIS Graphical Modeler
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:
...
9
votes
How to iterate through layers of an MXD?
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] # ...
7
votes
Accepted
Using only part of inline variable substitution string in ModelBuilder?
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.
...
6
votes
Appending polygons to existing feature class in ModelBuilder?
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 ...
5
votes
Accepted
Easy way to sum up a lot of values?
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/...
5
votes
Arcpy Search Cursor with Spatial Join
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 ...
5
votes
Accepted
Save geodataframes from list to separate shapefiles
Use zip:
import geopandas as gpd
import os
frames = [gpd.read_file(r'C:\GIS\data\testdata\ak_riks.shp'), gpd.read_file(r"C:\GIS\data\testdata\ak_riks_2.shp")]
names = ['r1.shp','r2.shp']
...
4
votes
Accepted
How to get only one biggest point in polygon?
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 ...
4
votes
Accepted
Running focal statistics with iterator in ArcGIS ModelBuilder?
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'...
4
votes
Accepted
Creating summary statistics table with as many rows as iterated features?
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/...
4
votes
Accepted
Creating file geodatabases in multiple folders using iterator?
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 ...
4
votes
How to change output folders when iterating a geoprocessing model?
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 ...
4
votes
Accepted
Iterate Row Selection Using Current Selection ArcMap 10.2 ModelBuilder
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 ...
4
votes
Accepted
Python: Point in polygon, boundary and vertex check (ray casting)
whether a point [(x,y)] lies within a polygon [(x,y), (x,y), (x,y), (x,y)] but the code fails if the point lies on a boundary or a vertex
You need to understand the topologic rules:
From Quirks of ...
4
votes
Accepted
How to combine while and if for iteration?
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 ...
4
votes
Accepted
ArcMap ModelBuilder: Have iterator run only once to test model?
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
votes
ArcMap ModelBuilder: Have iterator run only once to test model?
Put a definition query on the table where ObjectID < 1, then with the table open, run the model.
4
votes
Check for field, add or skip to next step if exists in ModelBuilder?
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. ...
4
votes
Create loop in ModelBuilder in ArcGIS?
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 ...
4
votes
How to loop a process in ModelBuilder?
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. ...
4
votes
Accepted
Using ModelBuilder to calculate multiple polygon areas into one table?
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 ...
4
votes
Accepted
Using iterator for lasd files in ArcGIS ModelBuilder?
I was able to get this to work and wanted to post my final solution. I used @jbalk 's answer with a Parse Path. I used Iterate Multivalue (input the lasd files). I connected the Value output to Make ...
4
votes
Accepted
Iterate through 30+ years of daily precipitation images to get monthly averages for the whole period
For this case, map month by month I think it's a better approach:
var pp_monthly = ee.List.sequence(0, (2021-1981)*12).map(function(n) {
var start = ee.Date('1981-01-01').advance(n, 'month');
var ...
3
votes
Iterate Row Selection takes too much of the model into ModelBuilder loop?
You need to separate your model into two models. As you have it now, the results table gets created with every iteration. Step 1 needs to be in separate model that calls a sub model, which performs ...
3
votes
Iterate Through Folders within Folders
Here's how to find all the mxds in a directory tree using the os module:
import os
for root, dirs, files in os.walk('C:/junk'):
for file in files:
if os.path.splitext(file)[1] == '.mxd':
...
3
votes
Using Feature Class name to populate new field
The ultimate in stupidity.
All I was missing (in any of the ways I approached it) was "QUOTATION MARKS" around the expression.
ie. Expression = "%Value%" if using Parse Path, or "%Name%" if not ...
3
votes
Using ModelBuilder to Iterate, Join & Export Feature Classes?
I'm not sure this is the answer that I was looking for (especially since the original model worked for another user), but I ended up getting it to run successfully with a bit of a work-around. I put ...
3
votes
Workspace or data source is read only
This might be a bit late. But if your are running into similar problems this can be useful:
If you are using Dropbox, try stopping its syncing and then quit it. Then close and reopen your ArcMap ...
3
votes
Accepted
Break down geoprocessing operation (Buffer) into smaller subsets
As a shapefile FIDs' are contiguous and 0 based, you can use that to your advantage:
import sys, os, arcpy
InFC = sys.argv[1] # must be a shape file
OutFC = sys.argv[2]
# change as appropriate
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
iterator × 308modelbuilder × 245
arcgis-desktop × 219
arcmap × 35
arcpy × 34
arcgis-10.2 × 24
arcgis-10.1 × 18
arcgis-pro × 18
loop × 17
raster-calculator × 12
spatial-analyst × 11
raster × 9
field-calculator × 9
arcgis-10.3 × 9
feature-class × 9
python × 8
pyqgis × 7
shapefile × 7
fields-attributes × 7
clip × 7
select-by-attribute × 7
select-by-location × 7
arcgis-10.0 × 6
attribute-joins × 6
precondition × 6