Tag Archives: New at 10.0
Finding the nearest feature with the same attributes
One of the key analysis functions of ArcGIS is the ability to determine distances between geographic features. One toolset in the Analysis toolbox, the Proximity toolset, contains several geoprocessing tools dedicated to calculating distances between or around feature locations. One of the tools in this toolset, the Near tool, is used to find which feature is the closest to each feature in an input feature class. Examples of using the Near tool include: finding the nearest high-school for each census block in the school district (closest facility problem); calculating the distance to the central business district as part of a site selection/suitability analysis; or determining the average distance to the closest park for different city districts, as a measure of quality of life.
The Near tool provides a simple but effective way for determining from a set of locations which is the closest. But what if the goal is to find the closest feature that has the same attributes as an input feature? Out of the box, the Near tool alone cannot answer this question unless your data is structured so that feature classes only contain features with like attributes (if this is the case, then you can simply run the Near tool once for each feature class, where the Input Features and the Near Features are both that same feature class). However, it is more likely that a feature class will represent similar features with some differences in attributes. For example, say you are analyzing data that represents samples of tree locations (a feature class where each point represents the location of a tree). This tree locations feature class will have an attribute field that specifies the exact species of tree that occurs at that location. Since the Near tool alone cannot find the closest feature within some attribute group, some work must be done to answer the question: How can I find the nearest feature with the same attributes?
Near By Group
Conceptually, this question can be answered by the Near tool (what is the nearest feature?). However, the question also contains a constraint (with the same attributes?) that is not directly supported by the Near tool. To answer the full question additional ModelBuilder techniques must be used, along with the Near tool, to create a custom workflow (this could also be done with scripting, but this entry focuses on a ModelBuilder solution). In ArcGIS 10.0, new iterator functions were added to ModelBuilder to allow for iterative or looping logic to be added to geoprocessing models. One of these model iterators, Iterate Feature Selection, allows for attribute groups to be designated and iteratively selected. Using selection sets output by the iterator allows for features belonging to the same attribute group to be iteratively fed into the Near tool – this will answer the question of which is the nearest feature with the same attributes.
In the graphic below, the Near By Group model is used to find the closest point of the same color. Since the Input Feature is red, the second red point is returned as the Nearest Feature, despite there being green and purple points closer than that second red point.

Workflow
The Near By Group tool is structured as a nested model tool where the main model, Near By Group, calls a submodel, Iterate Near. It is necessary to include the Iterate Feature Selection iterator and Near tool in a submodel since those are the only components of the model that should be run multiple times (every part of a model that contains an iterator will be run multiple times; you can separate the parts that should be run iteratively from those that should not by using this kind of submodel structure).
Main model (Near By Group)

1. Copy the Input Features to a new Output Feature Class
2. Add a Near ID field (this field will contain the ID of the nearest feature in the same attribute group)
3. Add a Distance field (this field will contain the distance from an input feature to the nearest feature in the same attribute group)
4. Run the submodel, Iterate Near, to execute the Near tool once for each attribute group (see the submodel steps below)
5. Delete the NEAR_FID and NEAR_DIST fields that were added by the Near tool (this information is contained in the new fields that were added in steps 2 and 3)
Submodel (Iterate Near)

1. Run an iteration to select all features that belong to an attribute group
2. Run the Near tool to determine the distance from each Input Feature in that attribute group to the nearest feature in that attribute group
3. Calculate the Near ID field (added in the main model, step 2) equal to the value of the field NEAR_FID added by the Near tool
4. Calculate the Distance field (added in the main model, step 3) equal to the value of the field NEAR_DIST added by the Near tool
More Information
The Near By Group tool can be downloaded from the Geoprocessing Resource Center here. The download contains the model tool, sample data, and the contents of this entry.
Network Analyst Barriers in ArcGIS 10
Great blog post on the ArcGIS Desktop blog about Network Analyst Barriers in ArcGIS 10. Find out how things have improved, and download a related model from the Geoprocessing Model and Script Tool Gallery that uses weather data to accurately measure travel times through severe weather conditions.
Image Classification toolbar introduced at ArcGIS 10
A new toolbar, Image Classification, has been introduced at ArcGIS 10 to make image classification tasks both faster and easier (to use this toolbar, you need the Spatial Analyst extension). Expressed simply, the image classification process converts multiband raster imagery into a single-band raster with a number of classes, which you can then use to make thematic maps or for further analysis. Example applications for image classification include landcover mapping and landuse change detection. Continue reading
2010 User Conference presentations
We had a great conference and it was good to meet and talk with everyone. We’ve been uploading our technical workshop and demo theater presentations to the Model and Script Tool Gallery, and you can easily find them from the Presentations page. Presentations include slides (in pdf format), demo notes (notes that we use to guide us during our demos), data, map documents, toolboxes, and scripts. Due to data distribution restraints, there are cases where we can’t distribute the data we used in the workshop or demo theater. In those cases we have done our best to include videos or tutorials that will supplement the slides. Not all presentations are uploaded yet, so keep checking back over the next couple of weeks if your favorite presentation isn’t there.
Customizing the Geoprocessing menu
There is a new Geoprocessing menu in version 10.0, illustrated to the left. The upper part of the menu contains 6 geoprocessing tools. The lower part contains actions that open other windows, such as Search For Tools which opens the Search window, and ModelBuilder which opens the ModelBuilder window. We’ve gotten a number of questions about the 6 geoprocessing tools listed in this menu. Continue reading
Changing Model appearance to 10.0 style
In version 10.0, ModelBuilder has a new style—tools are shown as a rectangle with rounded corners rather than a simple rectangle (without rounded corners). If you want to change the appearance of a model you created in previous versions to the new 10.0 style, do the following:
- Right-click your model and click Edit. This opens the model in ModelBuilder.
- From the File menu, select Diagram Properties.
- In the Diagram Properties dialog box, click the Symbology tab.
- At the bottom of the dialog box, click Style 2 then click Style 1. Switching from one style back to the other causes ModelBuilder to apply the new 10.0 style to your diagram.
- Click OK to dismiss the Diagram Properties dialog box. Your model will now have the new appearance.
If you decide you don’t want the new look, you can click the Undo button on the ModelBuilder main menu.
The New and Improved Raster Calculator tool for ArcGIS 10
In ArcGIS 10 the Spatial Analyst toolbox includes a Raster Calculator geoprocessing tool in the Map Algebra toolset. This is not the same raster calculator as in previous versions of ArcGIS, so keep reading to find out what it does, how it’s improved, and where to find more information.
The Raster Calculator geoprocessing tool in ArcGIS 10 is designed to execute a single-line map algebra expression using multiple tools and operators listed on the tool dialog. When multiple tools or operators from the tool dialog are used in one expression, the performance of this equation will generally be faster than executing each of the operators or tools individually.
The Raster Calculator tool has been designed to replace both the previous Raster Calculator from the Spatial Analyst toolbar and the Single Output Map Algebra geoprocessing tool. The Raster Calculator tool is like all other geoprocessing tools; it honors geoprocessing environment settings, it can be added to ModelBuilder, and when used in ModelBuilder it supports variables in the expression. The ability to support variables in the expression makes the new Raster Calculator tool much more powerful and versatile than previous Map Algebra implementations.
The Raster Calculator tool is used to execute Map Algebra expressions inside ArcGIS applications. The Raster Calculator is not supported in scripting because in ArcGIS 10 Map Algebra can be accessed directly when using the geoprocessing ArcPy site-package. This seamless integration of Map Algebra into Python extends the capabilities of Map Algebra by taking advantage of Python and third party Python modules and libraries; making Map Algebra far more powerful than it has been in the past. The Map Algebra language in ArcGIS 10 is similar to 9.x Map Algebra with minor syntax changes due to the integration of Python; most notably case sensitivity.
If you are interested in learning more about the new Raster Calculator tool or about Map Algebra in ArcGIS 10 please go to: ArcGIS 10 Help Documentation.
Post written by Liz Graham, Product Engineer on the Spatial Analyst team
The Power of the Results Window
Have you taken a closer look at the new dockable Results Window in 10?
The results window does so much more than let you check the messages of past tool, model and script execution. It stores past geoprocessing history including current, canceled and queued tools; a spot to re-run tools; copy code snippets as well as a place to check results. The window is especially useful for monitoring tool execution for background processing.
The window is broken into three sections; Current Session, Previous Sessions, and Not Run.
Current Session
Lists all geoprocessing results for the Current Session.
Previous Session
Tools that were executed previously have results saved here. The length of time these results remain saved depends on the Results Management setting from the Geoprocessing Options.
Not Run
This node represents tools which were started but then stopped (eg. ArcCatalog was closed while a background job was processing).
So what do the icons mean?
· Clock – Queued or pending tools waiting to execute
· Clock with green – Approximate percentage of tool completion
· Hourglass – A tool starting to execute
· Colored script - A script tool successfully ran
· Circle with Red-X – A tool which failed to execute due to errors
· Yellow exclamation mark – A tool which executed but has warnings
· Colored Hammer – Successfully completed tool
· Uncolored (hollow icons) – Tools which haven’t been executed
Tool Context Menu (Right Click)
By Right clicking each tool (whether it be queued, running or finished), you’ll be presented with a list of options.
- Open – Open the tool dialogue (with populated parameters based on the tool execution)
- Copy – Useful for copying the tool execution into a model
- Remove – Keep the data, remove only the result
- Re-name – Change the name of your tool execution to something more informative
- Copy as Python Snippet – Acts as an incredibly powerful “copy”. Generates into your computer’s clipboard the complete Python syntax to execute the tool along with the supplied parameters. This can be very useful when writing Python scripts as it will save time figuring out syntax and parameter order
- Delete – Delete both the result and any output datasets
- Re-run – Queue or start the tool to execute again with previously entered parameters
Even More
The last bit of functionality is the ability to drag and drop from the results window. You can drag input and outputs directly from the results window into the Map display, Table of Contents, ModelBuilder, and even the Python window. Coupling the Python and Results window together within your workflow will increase functionality by reducing typing and navigating the Catalog Tree.

