Tag Info

New answers tagged

0

If the cursor on your input_table ever returns no records from the query then I think it will either error or lead to numbers_facilities not being set. Perhaps use Get Count to test whether the query will return no records before opening a cursor using it.


0

Create the second iterator in a separate model in ModelBuilder. Once you've got that working you can insert it as a submodel into Iterator 1. ModelBuilder won't ordinarily let you nest iterators, but it will let you include a submodel. If that submodel has an iterator in it you can get around the "1 iterator only" limit.


2

Your model fails because your input shape files have names that contain spaces. As feature class names cannot contain spaces, you need to use add the Calculate Value tool to your model to remove spaces from your inline variable "Name" and replace them with underscores. In the model below, the Name variable is precondition to the Calculate Value tool. ...


4

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


1

Assuming you want to split any field with an underscore you can use ListFileds (which returns Field Objects) with a wildcard to get the fields to split then string.split("_") to break it up into parts then calculate with quotes to populate the string: import arcpy, os, sys InFolder = sys.argv[1] # folder for shapefiles, or database for feature classes ...


0

Thanks for your answer. I figured out what the issue was. If I use the script within my pre-code block, I need to define the variable %name%. This is what I wrote in my pre-code block script: def my_funcrtion(): import arcpy my_name = "%name%" fc = "C:/" + my_name + "/Dropbox/featureclass"


0

Thanks for your input and ideas. I have solved it by giving the same field name ("SJ_count") in my input feature classes X1, X2, X3. After the join I altered the field name using the in-line variable substution string (count_name) given with the iterator as my addition. So my new field name became "SJ_count_%count_field%). An example of a field name woud ...


1

It isn't possible to use more than one iterator in a ModelBuilder model. (Ref. A quick tour of using iterators for iteration, the first "Note" towards the end.) There are some ideas for getting around this limitation in Answers to this Question: Issue nesting two iterators for cost distance calculation (Model Builder)


0

you can use your inline variable directly in the calculateField tool. with a Python expression entered in the CalculateField tool, it would look like this: "C:\\Users\\{}\\Dropbox".format(%name%) The variable should be present in your model (right clic > create variable > Type = String). Here I renamed it "Name" and required it as a precondition, but ...


1

The issue strangely enough is caused by a dependency on Internet Explorer DLL dependencies of all strange things. It is triggered by opening the Item Description window - Try opening any tool, then opening the Item Description window for a tool, and then try re-opening that tool - the script error will occur. A quick fix for this is to go into the Internet ...


0

Hi Guys, I faced the same issue and I solved pretty much in the same way (hours lost finding out how to get rid of the $ as well!!). I used a wild card (Iterate Table > Make Var > from Par > Wildcard) to selct correct Exxcel sheets within the table. Sometimes it can be useful. Cheers, Marco


0

Since you want to save to points outside the buffers, I would recommend to use the Difference operator instead of select and then save. Of course it's still interesting to check if select by location works correctly in models but it's not necessary for this use case I think. Update: Try setting the input of Save selected features to be the output of ...


0

Build your model and make sure it works. Use Feature Layer instead of feature class as the input of your model. to do so, simply drag the layers to your model. after you successfully run the model, close it and right click the model in the Catalog Window > Properties Go go parameters tab and click the plus button to add a new parameter select the ...


3

It lools like the problem is that pnt has no spatial reference and arc is having a spit, It's that or your field isn't being retrieved correctly, it's best to use row.getValue(field_name) rather than row.field_name as getValue is more flexible. Please ensure the fields X_Coord and Y_Coord exist in your layer (and aren't turned off) in the layer dialog. Try ...


1

Insert > Variable, and choose Raster Catalog. Create a set of raster catalogs in a geodatabase by right clicking on the GDB and selecting New -> Raster Catalog, and then right clicking on the newly created catalog and clicking Load -> Load Raster Datasets for your premade sets of raster groupings. Then right click on the variable and check the Model ...


1

First thing first is clean up the data. 1) Use the UNSPLIT LINE tool with the dissolve field set to the street names. 2) Use the 'Plannerize tool' on the output at step 1 to create segments between each crossing 3) Used the 'intersect tool' to create points at each intersection. (Join Attributes set to FID_Only and the output type should be set to ...


0

Personally I would try and use python in field calculator to achieve the desired result: accumulate( !HA! ) Pre logic script code: total = 0 previous = 0 def accumulate(increment): global previous global total if total: total = increment + previous previous = increment else: total = increment previous = increment return total


1

I don't consider this a complete solution as it relies on non-out-of-the-box tools and isn't fully tested. It also may require an Advanced license. For now I am removing the comments I made linking to questions with methods using the start and end nodes of the lines, as after some testing I'm not sure how to apply that to this problem (while at the same time ...


5

It looks like the arcpy.SetParameterAsText() function takes two parameters: the parameter index position, and the parameter value. Rather than trying to assign the value to the function you need to provide it as the second parameter. This: arcpy.SetParameterAsText(0, decadesText) Not this: arcpy.SetParameterAsText(0) = decadesText


1

If you are using model builder and want to create a list of values then use the Field Values iterator and send the output to a Collect Values tool. Expose the output values as a parameter, then embed this sub-model into the master model. Having created your list of values (in your example you are returning just two values) you can use the Calculate Values ...


1

You can do it using QGIS, this way: Open QGIS and open the QGIS Python console (Plugins->Python console). Check the following Python code snippet. Adjust the lines below the block Settings (i.e., myDir, myTargetDir, refSys, separator, xField, and cyField) to configure your own data: import os import glob # Settings myDir = '/path/to/txt/files/' # For ...


1

So, the output data of your model is a single feature class that represents the analysis' results (buffering). After running the model and exploring the results in ArcMap, you are not satisfied with this and want to re-run the model using another input parameters' values (e.g., another buffer distance). The only thing you need is just to allow the model to ...


1

Make XY Event Layer is the tool you're looking for. You could import your text files into a file geodatabase and iterate through the feature classes, creating a new feature layer for each of your text files.


0

What you are showing in the image is Join Field tool in batch mode (it is not a model created with model builder). So I think there is misunderstanding here! To achieve your goal do these steps: create an empty model Go to Insert > Iterators > Feature Classes Double click on "Iterate Feature Classes" tool and select your workspace (which contains your ...


0

You can delete all the excess fields using the 'delete field' tool. Within this tool you can easily select all the fields that you don't want to have, even if the table still needs to build through model builder.


0

A couple things to consider about your problem: GRID files can only be 9 characters long. GRID files like to have lots of associated files with them, and model builder doesn't do a very good job of cleaning them up after processes have been run. That said, I offer 3 solutions, since I have faced the exact same problem. I wasn't doing euclidean distances ...


0

With model builder, the best solution is to use "summary statistics" then join the resulting table with your dissolved feature class. You'll need to add a new field with a single value, so that the "summary statistics" works on the full table.


-1

I am not good at writing English but I want to share this problem and hope this answer can help you. Using "Python" on (Calculate field tool) in ModelBuilder: Python language: !shape.area@squarekilometers! use for Area squarekilometers Python language: !shape.area@squaremeters! use for Area squaremeters Python language: !shape.area@acres! use for Area in ...


0

The solution is python using a cursor and dictionary to do the matching look-up and then output the result with an insert cursor to an empty feature class that has the same feature type and data structure as the original mineral lease with the additional Lease ID field from the table. The code to do the look-up is incredibly fast this way. Here is some ...


5

From there error message, it looks like you are using a custom (non-standard) toolbox. arcpy.ImportToolbox("Model Functions") Try finding where that custom toolbox is located. Easiest way is to right click on it and select properties. Then include the full path to it in your code and include the tbx extension. ...


1

You are making the classic mistake that a lot of people do. If you read the help file of the Append tool it takes a LIST of datasets. Currently your model is appending on ever iteration which is very inefficient. You can improve model performance by sending the output of the Select Data tool (Routes) to an in_memory workspace then feed that tool into a ...


3

There is an Esri blog post that describes the technique for doing this in detail called If you are stuck at "if" – Part 1: Part 1 – Gives examples of quick and dirty ways of using the Calculate Value tool to create branches using if statements in a model. In your case you want to check for the existence of a feature class rather than a product ...


0

The problem, as indicated in gcarillo's answer, are the single \ characters, specially before the closing quote. Some solutions: Use / instead of \. Windows normally uses backslashes, but forward slashes work too except in the command prompt (cmd.exe). Raw strings can be useful, but they don't help with strings that end in a backslash. My favorite ...


4

You should escape the \ character, this way: def a(Status, User, Tile): if Status == "Available": return "C:\\Data\\" + Tile else: return "C:\\Data\\" + "Tile" + "_" + User



Top 50 recent answers are included