Tag Info

Hot answers tagged

11

Two approaches are possible, depending on what your goal is. Display Purposes Only, Don't Want Extra Field This isn't a function in ModelBuilder, but rather a question of how the number is being displayed in the attribute table. Here's how to change that (based on these instructions): Right-click on the field heading (SUM_Acres_) and choose "Properties" ...


5

It has already been created. Try SplitLayerByAttributes


4

Alternatively, you can create a string field and calculate the following into it using python: {:,}'.format(!SUM_Acres_!)


4

A shapefile is a kind of feature class, like an FGDB feature class or an SDE feature class. Use iterate feature classes in modelbuilder. You can then output as a feature class, and if it is named correctly (c:\path\to\directory\that\exists\output.shp) you will get a shapefile out.


3

I adapted the solution to move / shift points point into a certain direction (angle) and a given distance. Looks like: def shiftXYCoordinates(shape,angle,distance): point = shape.getPart(0) point.Y += distance * math.cos(math.radians(angle)) point.X += distance * math.sin(math.radians(angle)) return point and be called like shiftXYCoordinates(!SHAPE!, ...


3

On your return statement - remove the colon at the end. i.e.: def gst(old_value): if old_value == 'P00': return A91 Also, if A91 is not an existing variable, and you want to have it as a string - you must enclose it in quotes -> 'A91'


2

You would need to have a column in your input feature class which will represent the RouteName (i.e., feature1 and feature2 belong to routeA; feature3 and feature4 belong to routeB and so on). After you've prepared the input feature class (or maybe you already have one), you would need to use the Add Locations GP tool to load the stops into an existing ...


2

I use this function in python to test if a layer has a selection: def hasSelection(lyr): ''' Check whether specified layer has a selection. ''' import arcpy desc = arcpy.Describe(lyr) if len(desc.FIDSet) == 0: # Layer has no selection return False else: # Layer has a selection return True


2

Yes, if ModelBuilder finds a corrupt file or if any of the processing fails at any point, the model will stop and you will receive an error message. You may be able to handle, or bypass, some of these errors within ModelBuilder. ModelBuilder has rudimentary error handling capabilities using Python code block in the Calculate Value tool. There is a very ...


2

As far as I am aware you can not get the sequential display of interactive model dialogs that you want in standard model builder. Chaining the submodels in model builder gives you the complete list of all the parameters in the GUI, as you have found out. To simplify the GUI, you would have to switch to a Python toolbox, which gives the option of ...


2

The simplest solution is probably to create a topology with the Must Not Overlap rule, select all errors in the Error Inspector window, right-click and choose Substract: You can find out how to create a topology here if necessary. You can create the topology, add feature classes and rules with ModelBuilder with the tools from the Topology toolset, but you ...


2

Create two models. One main and one sub. In the sub model, iterate through a folder to pick up the individual bands. Add Collect Values at the end of the model. Refer to the tool documentation for usage info. In the main model, call the sub model and pass the output from collect values to the composite bands tool.


2

I actually just did something very similar to this in another script, so I'll drop this here if anyone finds it useful. It's 10 lines if you remove the comments. import collections #Summarizes the second number in a list of tuples by the occurrences in the first #e.g., [["a", 1], ["b", 2], ["a", 3], ["c", 7], ["d", 0], ["c", -1]] -> #{'a': 4, 'c': 6, ...


2

Before getting to the solution to your question, I need to clarify exactly what you're wanting to divide/compare. If you're wanting the areas in all of red vs all of green, you can skip this part. However, if you want to directly compare the areas of name and type within the same total boundary, you'll need to first clip red to the extents of green. Your ...


2

I would use an UpdateCursor approach. You will first need to add a new text field to your FC so that you can store the commas. You cannot add commas to integer, float, or double type fields: arcpy.AddField_management(fc, "newField", "TEXT") Then loop through your rows and apply the proper formatting (e.g. convert 300000.456 to 300,000) newValue = ...


2

What's the end goal? If you simply want to display the numbers rounded to whole values with thousands separators, you can do so using Number Formatting within ArcGIS. Search the documentation for "thousands separator" to see all the places this formatting can be configured. You can use that Python string in a Calculate Field function. Before you can ...


1

How about making a script tool via Python? I use the scipy Python module... scipy.stats.linregress() http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.linregress.html Installing scipy on the top of the ArcGIS Python install is not very straightforward, so beware...


1

I came up with a solution. It sounds complicated but we are looking at six tools and an iteration here! I copy my Shapefile A, use the dissolve Tool to dissolve shapefile A by Name. Then I use this created Shapefile as a in the Split Tool as the Split feature for Shapefile A. I insert into my model Iterate Feature and chose my Split output as a Workspace ...


1

This is a pretty straightforward task. Hopefully this will get you started: import os, arcpy folders_in = [] #Build this manually or with os.walk()/os.listdir() folders_out = [] exp = '"{:,}".format(!SUM_Acres_!)' #Loop over each folder and get the shapefiles inside for f_in, f_out in zip(folders): arcpy.env.workspace = f_in shapefiles = ...


1

How about this: Manually add the 2 fields to your watershed featureclass because at the moment the iterator will try and run that logic every time. So the Rb_Test_EZG layer feeds directly into the iterator. Your iterator output I_Rb_Test_EZG could feed into 2 Field calculate tools that pass in the integral and value values using in-line substitution to ...


1

I've made some modified and an additional tools to make this Model Builder a final one. I ran this on test and this works very nicely !! I would like to thank Erica for her help to make this possible


1

I'm guessing based on your final image that while the green does provide 100% coverage, it is broken up into separate polygons - otherwise (if it were a single giant polygon) you'd be getting nothing selected. The problem is your Relationship choice. Within means that only whole polygons (not areas or parts of polygons) from layer A that lie within a ...


1

The raster equivalent to the Make Feature Layer tool that is often mentioned on this site is Make Raster Layer (Data Management): Creates a raster layer from an input raster dataset or layer file. The layer that is created by the tool is temporary and will not persist after the session ends unless the layer is saved to disk or the map document is ...


1

Unfortunately, at the moment (ArcGIS 10.2.2) you cannot initiate opening multiple models. You would need to have several models created within a toolbox and then user will need to run each of them. I suggest taking a look at Python toolboxes. There you can create categories for parameters (this can move you a bit closer to what you want). You will be able ...


1

If you are running a model you created using Model Builder and one of your datasets fails for whatever reason, the tool will stop running. However, if you are using an iterator, any data created as an output prior to the iteration with the failure should still exist. For example, if you are using Model Builder to iterate through 100 rasters and perform ...


1

The definition query of the layer and zooming to is the easy part: import arcpy # Assuming that Value is set by the form, there is only one data frame # and the layer name is LayerName doc = arcpy.mapping.MapDocument("Current") dataFrame = arcpy.mapping.ListDataFrames(doc)[0] # the first data frame MapLayers = ...


1

The problem in your current method, and the reason summarizing afterward as @Branco suggests would not work, is that your spatial join operation creates the first attribute you want (total points per poly) while it destroys/eliminates the second variable (owner) you want to summarize. In order to summarize, you need whatever variables you want in the same ...


1

If you have two sources, first join them together, either by spatial or attribute criteria. Then you can use columns of both data sources in the Field calculator. Field calculation examples using code blocks and multiple parameters.



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