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 ...
user avatar
  • 48.6k
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: ...
user avatar
  • 72.3k
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] # ...
user avatar
  • 29.2k
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. ...
user avatar
  • 3,870
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 ...
user avatar
  • 2,781
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/...
user avatar
  • 15.5k
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 ...
user avatar
  • 34.6k
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'] ...
user avatar
  • 52.2k
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 ...
user avatar
  • 6,146
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'...
user avatar
  • 9,567
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/...
user avatar
  • 3,788
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 ...
user avatar
  • 1,347
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 ...
user avatar
  • 1,821
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 ...
user avatar
  • 38.8k
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 ...
user avatar
  • 51k
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 ...
user avatar
  • 9,567
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.
user avatar
  • 6,876
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.
user avatar
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. ...
user avatar
  • 38.8k
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 ...
user avatar
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. ...
user avatar
  • 21.3k
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 ...
user avatar
  • 6,400
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 ...
user avatar
  • 91
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 ...
user avatar
  • 12.1k
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 ...
user avatar
  • 3,870
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': ...
user avatar
  • 4,613
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 ...
user avatar
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 ...
user avatar
  • 61
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 ...
user avatar
  • 155
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 ...
user avatar

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