Category: Analysis & Geoprocessing
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
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.
We’ve created a new resources page that we’ll be using to provide the latest resources and news. You can still use http://esriurl.com/spatialstats to get there, or access it directly at https://spatialstats.github.io/. If you have this blog post bookmarked, you may want to update it to the new site so that you don’t miss out on new resources!
The International User Conference is less than 4 weeks away, and here on the Geoprocessing and Spatial Analysis Team we’re already getting excited. The chance to get down to San Diego to meet and work with all of you is something that many of us look forward to all year. We’re already busy polishing our Technical Workshops and bringing our demos together. I’m sure many of you who are attending started planning your sessions, workshops, island times and extracurricular activities in the Gas Lamp district weeks ago! If you haven’t started planning you may want to use the Agenda Search tool to identify sessions of interest to you.
Some sessions that are sure to be popular this year include:
- Intro to Model Builder
- Python Essentials (Introduction / Fundamentals)
- Fundamentals of GIS Analysis (Proximity and Overlay)
- Spatial Pattern Analysis
- Python Scripting and Map Automation in ArcGIS 10
And don’t forget that we are also working on a number of demo theater presentations that should be interesting, so make sure you stop by the Spatial Analysis Island to check them out.
We hope to see you in a session, or in the very least stop by the Spatial Analysis Island and say hi! And if you can’t make it to this year’s User Conference; don’t worry. Many of the slides and video presentations will be posted in the conference proceedings.
This post was written by Kevin Hibma and Lauren Rosenshein, Product Engineers on the Geoprocessing Team
Have you ever found yourself working on a project in ModelBuilder wanting to format an output or a field name and didn’t quite know how to accomplish that because you’re not that versed in Python? Here are three examples that do just that. The first example date-stamps the outputs of a workflow; the second includes the buffer width to ensure unique, descriptive output names; and the third formats the value of a text field. The first and second example use the operators Iterate Multivalue and Iterate Feature Classes, respectively, both new in ArcGIS 10.
Appending a date stamp to the output name using Calculate Value
Let’s say your goal is to give your output data a date stamp. This example workflow selects businesses by type, sums their sales by business type, and date-stamps the summed result. Having the model in place, you can run this workflow daily, weekly, monthly, quarterly, etc. on a variety of scenarios. The model iterates through a set of selection expressions using the Iterate Multivalue operator. Table Select uses these expressions against the Input Table.
With each iteration the first Calculate Value outputs the string for each business type using ModelBuilder’s built-in system variable %n%; it returns the business types by index, starting with index position zero. Here’s the copy-ready code snippet…
bt = [‘Café’, ‘MovieTheater’, ‘Restaurant’, ‘ServiceStation’, ‘Store’]
Table Select, in turn, appends the string to the Output Table name using the inline variable %BusinessType%. And this in turn, supports that the Summary Statistics’ outputs are identified by business type and date-stamp as shown below.
The Precondition on the first Calculate Value ensures the tool executes after the iterator. The Precondition on Table Select ensures that Calculate Value provides the business type string for the inline variable %BusinessType%. The Precondition on Summary Statistics ensures that the value for the inline variable %Date% is available from the second Calculate Value before the tool sums the sales by business type and date-stamps them. This copy-ready code snippet returns the date…
The inline variables %BusinessType%_%Date% guarantee a unique date-stamped output name…
Adding a date stamp to outputs like sales summaries lets you readily organize and compare results. Date-stamping provides flexibility and consistency, besides being a great organizational tool.
For improved performance, send the Table Select output to memory like so: in_memory<tableName>, or use Make Table View in place of Table Select—both are faster because they only write to memory, not to disk.
Including the buffer width in the output name using Calculate Value
Including the buffer width in the output name is useful when you’re creating multiple buffers in conjunction with the Iterate Multivalue and the Iterate Feature Classes operators. And doing that is no big deal until you realize that the buffer Distance is a 2-piece value: 75 Meters. The value is made up of the actual linear distance and the unit of measure, with a space between them. Spaces are not permitted in an ArcGIS output name! So, to include the buffer width in the output name, you need to remove the space. This is what Calculate Value does.
The example model iterates through the set of six buffer widths. In the Calculate Value tool’s Expression parameter, Python‘s .replace(“<val>”, “<val>”) function removes the space from the Distance value.
The Precondition between the Buffer tool and the output of the Calculate Value tool ensures that the formatted buffer width is available before the Buffer tool runs. The Buffer tool appends Calculate Value’s formatted output string as inline variable %BufferWidth% to its output, ensuring unique output names for each iteration of this workflow.
If you want to buffer multiple feature classes in a file geodatabase or in a folder with a sequence of buffer widths, embed the above model in a model that uses the Iterate Feature Classes operator to access the feature classes, like so:
In this case, the Buffer tool’s Input Features, set as model parameter in the embedded model below, are undefined so you can connect the output of Iterate Feature Classes as input to Buffer. Buffer is represented above through the MultiBuffers Using IterateMultiValue_embedded model.
Formatting the string of a text field with Calculate Field
Let’s say your goal is to add a field that combines the values of the business TYPE field, its sales from the SALES field, and location from the ZIP field to form a string like this: Store_160910_30312.
The model copies rows of a Customers table, adds the text field: ‘TypSalesZip’, and formats the field value using Calculate Field with a Python expression.
To access a field’s value and format it, here with the replace (<val>, <val>) function, Python bookends the field name with exclamation marks, like so: !<fieldname>!.
!TYPE!.replace(” “, “”) + “_” + str(int(!SALES!)) + “_” + !ZIP!
The first part of the expression up to the plus sign takes the string of the source field and removes any spaces. The second part of the expression first turns the decimal dollar amount for SALES into an integer using int(); then it turns the integer dollar value into a string using str() and appends it to the business TYPE with an underscore. The third and final piece of the expression appends the ZIP code with an underscore. Scroll up a bit to see a section of the result again.
Use this Python snippet to format a field name in your workflows any way needed.
These three short Python snippets and the Calculate Value and Calculate Field tools offer you flexibility and consistency when formatting output names and constructing field values; both go a long way towards your productivity and when working on a team and sharing data and analysis results across departments.
Contributed by Barbara Bicking, Product Engineer on the Geoprocessing Team.
Do you regularly perform geostatistical interpolation using the same parameters? We know that copying and pasting the same parameters over and over can introduce error and can be pretty tedious. However, this process can be streamlined using the Create Geostatistical Layer Tool.
The Image Analysis window allows you to quickly access commonly used rendering and processing tasks for raster layers. This allows you to accomplish your work faster and easier. The Image Analysis window can be broken up into four sections: the layer list, the display pane, the processing pane, and the options dialog.
The layer list resembles all layers in the table of contents that work within this window. Raster dataset layers, image service layers, WCS layer and mosaic dataset layers will display in the layer list. Raster catalog layers and cache raster dataset layers are not accessible here. Once you select a layer in the layer list you can modify and use it with the display and processing pane options. Right-clicking on a layer in the layer list also brings up a context menu to accelerate or remove the layer as well as open the layer properties.
The display pane allows you to quickly access of some of the layer properties of the selected layer. This includes changing the contrast and brightness interactively through slider controls or changing the layer stretch type or resampling method. Properties of multiple layers can be changed at the same time through a multi-layer selection in the layer list.
The processing pane provides the ability to process data on the fly. Some of the processes you can run include applying a filter, clipping, compositing and data export. Simply select a single or multiple layers and buttons become active based on the properties of the selected layers. Once a processing button is clicked a new layer is created that shows the results of the process being applied. The output layer is in memory but can be persisted using the data export dialog.
The Image Analysis window options dialog allows you to change some default behavior in the display and processing panes. This includes pan-sharpening weights and methods or default standard deviation z values. The options on the stretch tab will also change the default raster layer behavior.
There will be more information about the display pane, processing pane, and accelerated rasters in upcoming posts.
Contributed by: Robert Berger
A user recently posted a great question on the forum about finding a good model using Ordinary Least Squares regression (OLS) and Geographically Weighted Regression (GWR). We know that sometimes finding a good model is not as easy as it looks in a demo, and we spent quite a while putting together some of our tips and tricks to help the user get on the right track. Some of the topics covered include transforming data that is not normally distributed, using coefficient maps from GWR to guide your variable choices, and the use of spatial variables.
Hopefully our response will be a resource to all of you as you use
regression analysis to answer questions and solve problems!
The video recording for the Managing
Imagery with ArcGIS 10 training seminar is now available to view online – for FREE.
Description of the training seminar
Imagery is mission-critical data for many GIS applications, but
managing and disseminating large collections of imagery can present a
challenge. ArcGIS 10 introduces the mosaic dataset, a new geodatabase
data model used to efficiently manage and serve imagery and other
raster data. ArcGIS 10 also provides core tools and an integrated
environment for image management and analysis. In this seminar, you
will learn about the mosaic dataset and the new tools and recommended
workflows for managing large collections of imagery and rasters in