Skip navigation
All Places > GIS > Analysis > Spatial Analyst > Blog
1 2 Previous Next

Spatial Analyst

19 posts

The following question was recently posted to GeoNet:

“I want to add wind direction and strength to a cost distance surface. How do I create a raster surface which incorporates these two factors…?“

In this blog post, the spatial analyst team responds to this user’s question.

 

The Path Distance tool in the Spatial Analyst toolbox can do part of this. It can be used to create an accumulative cost surface from costs that are determined by the direction of the wind. Unfortunately, Esri doesn’t yet have a way to make cost of motion vary based on both the direction and speed of the wind.

Also, when using Path Distance, it is extremely important to know in advance whether you intend to move from source cells to other cells, or vice versa. You will see that changing this intent changes the result dramatically.

If you decide to use Path Distance to incorporate only wind direction into your accumulative cost surface, here is what we recommend:

You can encode wind direction azimuths (clockwise 0-360 from north, both 0 and 360 are treated as “north”) in the input horizontal raster. In figure 1 below, a 10 x 10 horizontal raster is shown. It has a constant cell value of 90 and represents wind blowing to the east with some uniform speed over the study area.

You should not use wind speed as the friction cost surface, because that cost is paid regardless of which direction you travel through a cell. In fact, Path Distance doesn’t need a cost friction surface at all (nor do the other Path Distance tools: allocation, backlink).

Figure 1-A 10 x 10 horizontal direction raster used as input to Path Distance. Each cell has a value of 90 (wind blowing from west to east). Cell centers are shown in yellow, along with a vector field renderer (blue arrows).

 

Case 1: Motion from source

Let’s first assume that:

  • You are sitting on the single source point (the selected blue point in the center of the raster in figure 2).
  • That its easiest to move with the wind and impossible to move either against it or at right angles to it.
  • That you want to calculate accumulated cost from your source cell to every other cell in the study area.

For this case, you could use a horizontal_factor parameter value of Horizontal Forward Function AND (this is important) a source_direction parameter value of “FROM_SOURCE”. The result is shown in figure 2. You can see that your accumulated cost surface is only defined in areas that can be reached travelling with (or somewhat with) the wind.

Figure 2- The results of using Path Distance with the horizontal raster from figure 1 and the horizontal forward function. The single source is the selected point in the center and we want to know how expensive it is to reach other cells in the study area. The accumulated cost surface shows that we are only allowed to move with the wind, and its easiest to move directly east. For this result, we use the horizontal forward function AND a source_direction parameter value of motion from source.

 

Lets go into a bit of detail on how Path Distance turns wind direction into a travel cost (also called a weight). We zoom in on the single source cell and its 8 neighbors:

Figure 3 - Detail of source cell (marked with an S) and its 8 neighbors. Each cell has a wind direction.

 

From that source, we can move in 8 directions to reach a neighbor cell and we need to figure out what the step cost for that move will be.

Figure 4 - You can move 8 ways from the source cell to its neighbors. Each choice makes a different angle relative to each cell's wind direction.

 

In our case, the only thing that affects the step cost is wind direction. Each of those 8 step directions makes some angle with the preferred moving direction, which in this case is the wind direction.

HRMA calculation

 

We call this angle the horizontal relative moving angle (HRMA) because it is your direction of motion relative to an azimuth value stored in your horizontal raster. Each horizontal factor function turns this HRMA into a weight. In this case, we’ve used the Horizontal Forward Function. See this help topic for more details on HRMA.

The HRMA and horizontal factor function are evaluated twice for each of the 8 possible steps: once for the wind direction at the source cell and once for the direction at the neighbor cell. The two results are then averaged to get the horizontal weight to be used when calculating the cost of a step into the neighbor cell.

Case 2: Motion To Source

Now let’s assume that the single source point represents a location that you want to reach from other points in the study area. In this case, all inputs to Path Distance remain the same, except you now choose a source _direction parameter value of “TO_SOURCE”. Figure 5 shows the result. As you can see, the results are very different.

Figure 5 -The result of using Path Distance to find accumulated cost of travelling to the single source point from other cells in the study area: source_direction is set to “ motion to source”. All other inputs are the same as for figure 2.

 

Why are these results so different? In both cases, the accumulative cost surface is grown outward starting from the source and visiting all other cells; but in the TO_SOURCE case, the calculation of the HRMA is different, so the output of the horizontal factor function applied to that HRMA will also be different. In the TO_SOURCE case the HRMA is the geometric supplement of the HRMA calculated in the FROM_SOURCE case, as shown in figure 6.

HRMA value changes based on direction of motion

To summarize:

Path distance can adjust the cost of motion through a cell based on input data that describes, for each cell, the easiest direction to move through the cell. This calculation can produce very different results, based on whether you want to move from a source to other cells, or from other cells back to the source.

We haven’t explicitly talked about the vertical raster and vertical factor functions, but the reasoning process is basically the same as described above. However, instead of accounting for horizontal influences, the vertical factor determines the cost to overcome the changes in elevations (the slopes) between the cells.

 

 

 

The original blog content has been written by James TenBrink and Kevin Johnston and is available here: https://www.esri.com/arcgis-blog/products/arcgis-pro/analytics/creating-accumulative-cost-surfaces-using-directional-data/ 

 

James TenBrink is a senior software engineer in the raster analysis group at esri. He has a Bachelor of Science degree in Computer Science from Hope College in Holland, Michigan, and a Master of Science degree in Computer Science from Rensselaer Polytechnic Institute in Troy, New York. He has been with esri 28 years and has had an office in almost every building, on almost every floor, of the esri campus.

 

Kevin Johnston has been a Product Engineer on the Spatial Analyst development team for over 29 years. He has degrees in Landscape Architect from Harvard and in environmental modeling from Yale. At Esri, Kevin’s current focus is developing suitability and connectivity tools. He hopes the tools that he works on can help users make more informed decisions.

 

Currently, Euclidean Distance Mapping geoprocessing tools can be used to assign distance properties to raster cells. Example applications include distance from runways used as part of an airport noise model, or distance from streams used as a criterion layer in a habitat suitability model. From ArcGIS Pro 2.4 and ArcMap 10.7.1, you can now  use the Euclidean distance tool to consider an important use case: generating precise shortest paths around barriers. You can also use barrier-aware distance and allocation maps  to replace their corresponding cost distance versions as input layers in suitability models.

Consider these related use cases posted to geonet:

  • “Aim: To determine the shortest path from a nest to marine foraging locations for an individual bird. The bird is restricted to traveling along water only (i.e., freshwater and ocean).” [1]
  • “I have been running some least cost path analyses on manatee GPS telemetry data using ArcGIS 9.3.1.  The goal of this analysis is to create the shortest path between points without the path crossing land. [2]

Prior to ArcGIS Pro 2.4/ArcMap 10.7.1, the only way to plot shortest paths around barriers was to use the Cost Distance (CD) tool using a constant cost surface with a small, positive, non-zero cost for the areas where movement was allowed and either a high cost or nodata where movement was prohibited. As the geonet posters point out, the cost paths obtained from this approach are unsatisfactory. To drive this point home, lets recreate the seabird flight paths (using completely fake nesting and feeding site data) using the CD + constant cost surface approach. The study area is Vancouver, British Columbia.

Figure 1: Sea bird over-water flight paths created using the CostDistance + constant cost surface approach. The Cost Distance sources are the feeding sites in the northwest corner and the Cost Path As Polyline destinations are the nesting locations in the southeast corner.

 

Goodchild [3] discusses why these paths deviate. The underlying cost distance algorithm is based on an 8-way connected graph, which restricts the directions that can be considered, and the absence of meaningful variation in the cost surface (other than barriers) means that the CostPath/CostPath As Polyline operation doesn’t know which of many equal length routes to choose from.

At 2.4/10.7.1, we can do better, as shown below in figure 2 in green, using enhancements to the Euclidean Distance (ED) and Cost Path As Polyline GP tools.

Figure 2: Sea bird over-water flight paths (in green) created using barrier-aware Euclidean Distance and Cost Path As Polyline tools.

 

Figure 3: Detail showing Euclidean distance (in green) and Cost Distance (in blue) flight paths.

The CD paths in this example are only about 1% longer than the ED paths, but their deviations from the geometric shortest paths are significant.

There is also a geodesic option for ED, but we haven’t used it in this example because we wanted to compare results with CD.

 

Creating Shortest Paths With Barriers

To generate these improved paths, use the following workflow:

1. Create a barrier dataset. It can be any kind of feature class or a raster. In the example above, the barrier dataset is a polyline feature class representing coastlines. If it’s a raster, DATA cells act as barriers.

2. Use the Euclidean Distance tool instead of the Cost Distance tool. Specify values for the new optional input parameter “Input raster or feature barrier data” and the new optional output parameter “Out back direction raster”, as shown below:

 

Figure 4: Euclidean distance tool user interface

 

3. Use the Cost Path As Polyline tool to create the paths from the destinations (Nesting sites) back to the sources (Feeding Sites). This tool has been enhanced to accept the new back direction output from Euclidean distance:

Figure 5: Cost Path As Polyline tool user interface

 

Simple!

The Back Direction Raster

The new back direction raster, created by the Euclidean toolset, encodes a floating point azimuth value in the range (0.0, 360.0] degrees, with zero itself reserved for source cell locations. This azimuth points in the direction of the shortest path as it passes through the cell. This is different than the “Output direction raster” parameter, which uses the 1-360 azimuth value (rounded to an integer) to point directly at the closest source cell (the cell where the shortest path will eventually end).

You can always ask for the back direction raster to be generated whether or not barriers are specified. This provides a convenient way to use Cost Path As Polyline tool to identify which source cell is closest to a given destination cell (it’s the cell on which the polyline ends) even if you’re not interested in barriers or specific pathways. Locating this cell was difficult in earlier versions of the Euclidean toolset: For planar Euclidean distance, you could have done some math with the distance and direction outputs, but that wouldn’t work for geodesic output.

Barrier-aware Distance and Allocation Outputs

So far, we’ve emphasized the use of the new functionality in generating better shortest paths. For this application, the most important output was the new back direction raster, which gave Cost Path as Polyline the information it needed to plot those paths step-by-step.

The distance and allocation maps may also be directly useful. As an example, compare the euclidean and cost distance versions of the barrier-aware distance map in figures 6 and 7 below. The euclidean version avoids the distortions present in the cost distance version.

Figure 6: Barrier-aware Euclidean distance map used to compute the sea bird over-water flight paths.

 

Figure 7: Cost distance map produced from encoding coastline as nodata into a constant cost surface

Use of Distance and Allocation Outputs in Suitability Models

Let’s repeat that the difference between CostDistance and Euclidean Distance with barriers is that the former performs its computation using a network distance metric and the latter uses a euclidean distance metric. This is something to be aware of when using the outputs of cost distance as layers in a suitability model. It is probably the case that some other layers in that model assume a Euclidean distance metric, so the mixture of distance metrics in a single suitability model will introduce some amount of error into the model results. For example, if both the Cost allocation and Euclidean allocation datasets shown in the figure below were used in the same model, then the classification of cells near an allocation boundary becomes more uncertain, as shown below.

Figure 8: Comparison between cost allocation and barrier-aware euclidean allocation zones. Note the zig-zag distortion in the cost allocation boundary.

 

The only reason to mix distance metrics like this is because, up until now, there hasn’t been a good alternative. Also, the distance distortion itself is bounded by a factor of about 1.1 ([3, Table 2], so that may be good enough for many applications. However, now we have a better alternative for the special case of barriers on a constant cost surface. For a distortion free solution for more general cost distance problems, we’ll have to wait for an upcoming ArcGIS platform release.

Summary

This blog has shown you how to generate shortest paths around barriers, using the versions of the Euclidean Distance and Cost Path as Polyline tools available in ArcGIS Pro 2.4 and ArcMap 10.7.1. Also, if you are using cost distance tools with a constant cost raster (containing some nodata cells) to generate inputs for a suitability model, you should consider using the barrier-aware euclidean tools instead.

References

[1] Sea bird geonet posting

https://community.esri.com/thread/109625

[2] ManateeGISDB geonet posting

https://community.esri.com/thread/97784-least-cost-path-anomalies

[3] Description of length and direction distortions in current cost distance implementation

Goodchild, M. F. (1977). An Evaluation of Lattice Solutions to the Problem of Corridor Location. Environment and Planning A. 9. 727-738. 10.1068/a090727.

[4] Readable introduction to barrier-aware euclidean distance method

Sethian, J. A. (1997). Tracking Interfaces with Level Sets: An “act of violence” helps solve evolving interface problems in geometry, fluid mechanics, robotic navigation and materials sciences. American Scientist Vol. 85, No. 3 (MAY-JUNE 1997), pp. 254-263

 

The original blog is available at https://www.esri.com/arcgis-blog/products/spatial-analyst/analytics/doing-more-with-euclidean-distance-barriers-and-paths/

The content of the blog has been prepared by James TenBrink, a senior software engineer in the raster analysis group at esri. He has a Bachelor of Science degree in Computer Science from Hope College in Holland, Michigan, and a Master of Science degree in Computer Science from Rensselaer Polytechnic Institute in Troy, New York. He has been with Esri 28 years and has had an office in almost every building, on almost every floor, of the Esri campus.

The 2019 Esri User Conference (July 8-12) is almost here. We here on the Raster Analysis team are busy practicing and polishing our presentations and are looking forward to showing you what we’ve been working on since last summer.  If you do any kind of raster or multidimensional analysis, please look at the guide below to help you plan out your time with us.

Expo hall

Visit the UC Expo to meet with us and with several amazing exhibitors. The UC Expo Hall has extended hours on Thursday this year, meaning more time is available for you to come by and get your questions answered.

Tuesday, July 9th         9:00 AM – 6:00 PM

Wednesday, July 10th  9:00 AM – 6:00 PM

Thursday, July 11th      9:00 AM – 4:00 PM

Technical Workshops and Demos

To help target your areas of interest, we’ve categorized workshops and demos relevant to raster analysis with Spatial Analyst into different groups.  In each group, you will find the general purpose of the sessions within the group, followed by the specific session titles in chronological order. Repeat presentations are also listed, in case you are not able to attend the first offering. Finally, remember to check out the Road Ahead sessions for a peek into the future.

1.     Raster Analysis

The ArcGIS platform offers many capabilities for raster analysis, data management, and spatial modeling.  Attend the introductory sessions to get a broad overview of the capabilities for raster analysis.  If your interest is more for specific types of analysis, such as suitability modeling, cost distance modeling, or hydrological modeling, we offer many sessions more specifically focused on those areas.

Raster Analysis
Tuesday, July 9
10:00 AMSpatial Analyst: An IntroductionSDCC – Room 30 B
10:00 AMHydrologic Analysis and Applications in ArcGISSDCC – Room 33 C
11:15 AMWorking With Living Atlas Data: Habitat ModelingSDCC – Expo Demo Theater 11
1:00 PMInterpolating Surfaces in ArcGISSDCC – Room 33 C
1:15 PMMap Algebra: Getting StartedSDCC – Expo Demo Theater 10
1:15 PMWorking With Living Atlas Data: Elevation AnalysisSDCC – Expo Demo Theater 11
4:00 PMFinding the Best Locations Using Suitability ModelingSDCC – Room 33 C
Wednesday, July 10
8:30 AMCost Distance Analysis: Identifying the Best PathSDCC – Room 30 C
11:15 AMSurface Interpolation in ArcGISSDCC – Expo Demo Theater 10
1:15 PMBobcat Suitability ModelingSDCC – Expo Demo Theater 10
2:30 PMSpatial Analyst: An IntroductionSDCC – Room 32 A/B
Thursday, July 11
2:30 PMFinding the Best Locations Using Suitability ModelingSDCC – Room 15 A
4:00 PMCost Distance Analysis: Identifying the Best PathSDCC – Room 17 A
4:00PMInterpolating Surfaces in ArcGISSDCC – Room 15 A
4:00 PMHydrologic Analysis and Applications in ArcGISSDCC – Room 14 A
Raster Data Management
Tuesday, July 9
10:00 AMBasics of creating a Mosaic DatasetSDCC Demo Theater 2
Thursday, July 11
11:15 AMManaging and Serving Elevation and Lidar DataSDCC Demo Theater 2

2. Raster Analysis using Python

The integration of Map Algebra with Python via the Spatial Analyst ArcPy module offers a broad range of capabilities for raster analysis, data management and automation workflows. With the arcgis.raster module in the ArcGIS Python API, you can perform raster analysis on very large raster datasets in the server environment. Various Python packages also let you extend your analytical power though custom tools, as well as machine and deep learning.

Tuesday, July 9
1:15 PMArcGIS API for Python: Integrating Machine Learning and Deep LearningSDCC – Expo Demo Theater 08
2:30 PMPython: Raster AnalysisSDCC – Room 30 A
Wednesday, July 10
10:00 AMArcGIS API for Python: Imagery AnalysisSDCC – Room 16 A
4:00 PMPython: Raster AnalysisSDCC – Room 30 A

3.     Raster Analytics using ArcGIS Image Server

The Raster Analytics capabilities offered by ArcGIS Image Server can be used to enable cloud computing, which applies distributed computing and distributed storage technology to analyze and process large raster data collections.  The following sessions will introduce the capabilities of this product, describe the architecture, detail the deployment options, and identify the performance benefits offered by distributed processing.

4.     Scientific Multidimensional Data Analysis

The ArcGIS platform has great capabilities for the ingesting, management, visualization, analysis, and sharing of scientific multidimensional data.  If you would like to use netCDF, HDF or GRIB data for doing spatial and temporal analysis, the following sessions will be of interest to you.

Wednesday, July 10
2:30 PMAnalyzing Multidimensional Scientific Data in ArcGISSDCC – Room 33 C
Thursday, July 11
10:00 AMAnalyzing Multidimensional Scientific Data in ArcGISSDCC – Room 10
10:00 AMScientific and Multidimensional Raster Support in ArcGISSDCC – Room 05 A
10:30 AMWorking with Scientific Data in ArcGIS PlatformSDCC – Expo – Open Platform: Standards & Interoperability Spotlight Theater

5.     The Road Ahead

Come join us for the Road Ahead sessions to find out what enhancements have been made in spatial analytics and what we are planning for the upcoming year, especially in the areas of machine learning, big data and real time analysis.

Tuesday, July 9
4:00 PMArcGIS Enterprise: The Road AheadSDCC – Ballroom 06 C
4:00 PMArcGIS Pro: The Road AheadSDCC – Ballroom 06 B
Wednesday, July 10
8:30 AMArcGIS Enterprise: The Road AheadSDCC – Ballroom 06 C
10:00 AMSpatial Analysis and Data Science: The Road AheadSDCC – Ballroom 06 D
Thursday, July 11
10:00 AMSpatial Analysis and Data Science: The Road AheadSDCC – Ballroom 06 D
1:00 PMArcGIS Pro: The Road AheadSDCC – Ballroom 06 D
Friday, July 12
9:00 AMArcGIS Pro: The Road AheadSDCC – Ballroom 06 F

Special Interest Group Meetings

Special Interest Groups – or SIGs—are communities within multiple organizations with a shared interest in advancing a specific area of knowledge, learning, or technology. Every year, the Esri UC supports dozens of SIG meetups, both technical and non-technical. SIGs are a great way to network with your peers and learn something new. We encourage you to check out and participate in any of several SIG meetups highlighted below.

Sunday, July 07
7:30 am – 5:00 pmImagery SummitMarriott – Marina Foyer
8:30 am – 5:00 pmGeoSpatial Deep LearningSDCC – Room 32 A/B
9:00 am – 4:30 pmEsri GIS Hydro MeetingMarriott – Santa Rosa
Tuesday, July 9
11:30 am – 12:30 pmOcean SIGSDCC – Room 26 A
Thursday, July 11
11:30 am – 12:30 pmWeather and Climate SIGSDCC – Room 17 A

Summary, and come see us!

Additional details on these sessions listed above, and much more, is available in the full agenda. Be sure to download the Esri Events Mobile App, too!   (UC content coming soon)

Please come by the Spatial Analyst island within Spatial Analysis & Data Science at the Product Showcase in the Exhibit Hall during the week (Tuesday and Wednesday from 9:00 – 6:00, and Thursday from 9:00 – 4:00.  We’d love to hear about the work you do, any difficulties you have encountered, and any ideas you might have to make our software suit your needs even better.

***Note: All listings subject to change; not every paper or event may be presented here. For the list of the all sessions visit the full agenda page.

ArcGIS Pro 2.3 and ArcMap 10.7 Spatial Analyst tools now support a new environment, the Cell Size Projection Method, to control the calculation of the output raster cell size when datasets are projected during tool execution. To learn more about projections, see Coordinate systems, projections, and transformations.

In previous software versions, the cell size was converted using a linear unit conversion when projecting from a Projected Coordinate System (PCS) to another PCS or an angular unit conversion when going from Geographic Coordinate System (GCS) to another GCS. So, projecting a 30 meter raster dataset from UTM zone 10N to WGS84 Web Mercator would continue to use 30 meter as the output cell size. When projecting from GCS to PCS or vice versa, previous versions took an average cell size based on the ratios of diagonal lengths in source and destination projections. Therefore, this method, currently exposed as the ‘convert units’ method simply copied the cell size from input to output, changing units if necessary.

This approach has some limitations:

  • It does not account for distortion when projecting from one PCS to another PCS (1 projected meter in, say, a UTM zone at a given location may not cover the same ground distance as 1 projected meter at the same location in an Albers projection).
  • When computing the ratios of diagonal lengths, the behavior of the projection at only the four corner points was used. This may have introduced excessive distortion, depending on the projection and the extent.

The two new methods: ‘preserve resolution’ and ‘center of extent’ both are intended to calculate a projected cell size that doesn’t change the ground distance of the cell, thus avoiding unnecessary resampling during an implicit projection operation happening as a Spatial Analyst tool or a feature to raster conversion tool executes. You should use the ‘center of extent’ method when you know the geographic location where your cell size is most accurate. If you use this method, you can use a raster with a small extent in that same area as the cell size source or create a temp raster ‘around’ that location and use that as the cell size source. If you are unsure, use the ‘preserve resolution’ method. To learn more about the three cell size projection methods see How the Cell Size Projection Method environment setting works.

If you do not know at which specific geographic location your cell size is best but want to improve on the ‘convert units’ method when a projection is involved while working with Spatial Analyst tools, you can use the ‘preserve resolution’ method.

Why use the resolution preserving cell size projection method?

In the ‘preserve resolution’ method the same number of square cells as are in the original extent are preserved in the projected extent. The output cell size is calculated based on the ratios of the areas of the projected extent to the original extent. This approach is based on how Esri software currently chooses a cell size when moving from a camera image coordinate system to a geodetic (GCS or PCS) system. This method calculates the average size of a square cell more accurately for all combinations of GCS and PCS than the default ‘convert units’ method.

If the areas of the original rectangular extent and (shape preserving) projected extent are A0and A1, then the areas of the square cells, respectively, are, ca0 = A0/n and ca1 = A1/n

Since the number of cells remains constant for both cases, the ratio of the area of extent to the area of the square cell are equal, A0/ca0 = A1/ca1

Figure 1: Cell size projection using the new ‘preserve resolution’ method

Figure 1: Cell size projection using the new ‘preserve resolution’ method

 

So, the output cell area is ca1 = (A1/A0) * ca0

and the output cell size is CellSize_projected = √((A1/A0) * ca0)

In this method, the cell size conversion factor is, √(A1/A0)

Let’s look at two examples to see how the ‘preserve resolution’ method picks a better output cell size than ‘convert units’.

Example 1:

Let’s take an elevation raster (R_input), located in Vermont (Figure 2), in a PCS (NAD_1983_StatePlane_Vermont_FIPS_4400) and project it to another PCS (WGS 1984 World Mercator) using the default cell size projection methods, ‘convert units’ (R_out_CU) and ‘preserve resolution’ (R_out_PR). Here both the spatial references are shape preserving, where the input spatial reference is suitable at a state level and the output spatial reference is suitable for the entire world. We will then compare the geodesic distance between the cell centers to determine which method preserves the geodesic distance more accurately.

 

Figure 2: Location of the input raster (R_Input), its cell boundaries and cell centers.

Figure 2: Location of the input raster (R_Input), its cell boundaries and cell centers.

 

Before we compare the geodesic distances between the two methods, lets understand what are the different ways a raster is projected in ArcGIS Pro. When you add a raster to the map in ArcGIS Pro, the spatial reference of the map becomes the same as the spatial reference of the raster. For example, if the first layer added has a NAD_1983_StatePlane_Vermont_FIPS_4400 PCS, the map will have the same spatial reference, and all other layers will project on the fly to match this spatial reference. This on-the-fly raster projection is meant for a richer display experience but does not preserve the raster structure (different cells can have on-the-fly-projected different sizes, rotations, and distortions). However, when you project a raster using the Project Raster tool or specifying the Output Coordinate System environment of a geoprocessing tool, the raster is actually  projected into a new raster structure (every cell is an identical rectangle in the output spatial reference, with sides parallel to the coordinate system axes). When measuring geodesic distance for the comparison of the cell size projection methods, it is recommended to use the actual projected raster instead of the raster that is projected on the fly.

In figure 3, the cell size of the input raster, R_input is 30 meters. This is approximately the same as its geodesic ground distance, which you can find out using the Measure tool in ArcGIS Pro.

 

Figure 3: Cell boundaries of R_input, cell centers of R_input, R_out_CU, R_out_PR and the geodesic distance between the cell centers. To overlay the points, the cell centers have been projected back to the spatial reference of R_input for comparison.

Figure 3: Cell boundaries of R_input, cell centers of R_input, R_out_CU, R_out_PR and the geodesic distance between the cell centers. To overlay the points, the cell centers have been projected back to the spatial reference of R_input for comparison.

 

When the raster is projected using the ‘convert units’ methods, the projected cell size of the output raster, R_out_CU remains 30 meters, but 30m in WGS 1984 World Mercator is a much smaller distance on the ground, 21 meters. So, raster projection using the ‘convert units’ method has unnecessarily increased the resolution of the output raster. If we were projecting in the opposite direction (starting from WGS 1984 World Mercator), then we would have lost a significant amount of raster data. When the same raster is projected using the ‘preserve resolution’ method, its cell size becomes 42 meters and the geodesic ground distance remains 30 meters, which is the same as the geodesic distance of the input raster.

Example 2:

In this example, we will project from a UTM zone to its adjacent zone, which can happen when mosaicking together many different DEMs for a larger (state sized) area. In figure 4, let’s take a raster (R_input2) in WGS 1984 UTM Zone 11N and project it to its adjacent zone WGS 1984 UTM Zone 12N, creating output (R_out_CU2) and (R_out_PR2) for ‘convert units’ and ‘preserve resolution’ respectively. From here we will again compare the geodesic distance between the cell centers to determine which method preserve the geodesic distance more accurately.

 

Figure 4: Cell boundaries of R_input2, cell centers of R_input2, R_out_CU2, R_out_PR2 and the geodesic distance between the cell centers. To overlay the points, the cell centers have been projected back to the spatial reference of R_input2 for comparison.

Figure 4: Cell boundaries of R_input2, cell centers of R_input2, R_out_CU2, R_out_PR2 and the geodesic distance between the cell centers. To overlay the points, the cell centers have been projected back to the spatial reference of R_input2 for comparison.

 

The cell size for the input raster, R_input2 is 30 meters, which is approximately the same as the geodesic ground distance in this area. When the raster is projected using the ‘convert units’ method, the cell size of the output raster, R_out_CU2 becomes 30 meters and the geodesic ground distance becomes approximately 31 meters. When the same raster is projected using the ‘preserve resolution’ method, its cell size becomes 28.99 meters, and the geodesic ground distance is 30 meters, which is the same as the input raster.

In both the examples, the ‘preserve resolution’ method seems to preserve the geodesic ground distance between cell centers better than the ‘convert units’ method. Other combinations of input and output spatial references may, of course, show difference between the methods, but overall it is safe to say that the ‘preserve resolution’ Method is a better approach for preserving geodesic distance while projecting datasets.

An important property of the ‘preserve resolution’ method is that the output cell size depends on the location of the dataset. The same combination of input and output spatial reference will yield a different output cell size if the input raster dataset is at a different geographic location. If you need to use one cell size for different raster datasets (for example, processing adjacent DEM tiles), specify one raster dataset to use as the cell size source while performing raster analysis for the tiles.

Next time you use a Spatial Analyst geoprocessing tool or python command to:

  • create an output with a spatial reference different from that of the input dataset,
  • use input datasets with different spatial references,
  • specify an analysis cell size using a dataset with a different spatial reference,

pay attention to the output cell size and consider using either the preserve resolution or center of extent methods. By default, the projection method will do the ‘convert units’, which existed in previous versions of ArcGIS, but as we have seen, this method may unnecessarily increase or decrease the resolution of your valuable raster data.

Additional resources

Handling projections during analysis in Spatial Analyst

How the analysis window is determined in Spatial Analyst

 

This blog post has been prepared by James TenBrink, senior software engineer in the raster analysis group at Esri, and Sarmistha Chatterjee.

Original post: https://www.esri.com/arcgis-blog/products/spatial-analyst/analytics/introducing-the-new-resolution-preserving-cell-size-projection-method/

As you will have heard, ArcGIS Pro 2.2, ArcGIS Desktop 10.6.1, and ArcGIS Enterprise 10.6.1are now available for download!  If you use the Spatial Analyst extension, or do Raster Analysis in general, read on for more information about the new capabilities on offer.

 

Where do I get it, and what’s changed?

 You can download and install the software right now from the following links: ArcGIS Pro 2.2, ArcGIS Desktop 10.6.1, ArcGIS Enterprise.  For a quick summary of all the changes that have been made for these releases, have a look at their respective What’s New topics:

                     - What’s New in ArcGIS Pro

                     - What’s New in ArcMap 10.6.1

                     - What’s New in ArcGIS Enterprise Portal

Here are the main categories of the changes.

                     1. New and updated tools for the Spatial Analyst extension in ArcGIS Pro and ArcMap.

                     2. Enhanced performance potential for Spatial Analyst tools with Parallel Processing.

                     3. New Raster Functions are available.

                     4. New capabilities are available for Raster Analysis through a Portal in ArcGIS Pro.

                     5. New capabilities are available for Raster Analysis through a Map Viewer with ArcGIS Enterprise.

                     6. If you perform Raster Analysis through the REST API, a new task was added.

Following that, some background information on how to configure and perform raster analysis with ArcGIS Enterprise is listed.

 

1. Spatial Analyst extension

For the Spatial Analyst extension product, there some changes to environment behavior, some tools have received new parameters, and more tools have been enabled for parallel processing.

Interactive Python Window

Spatial Analyst tools can use a new ArcPy environment,   arcpy.env.buildStatsAndRATForTempRaster, that can be set to true in the interactive Python window in the application to improve the display of the raster output. This property is accessible and can be set in a standalone python scripts, but will have no effect as the output is not displayed.

It is a Boolean environment that specifies whether or not to calculate statistics and build a raster attribute table for a temporary raster created from an interactive Python session while adding it to the map. It is True by default for all Spatial Analyst tools. When set to False, the statistics will be approximate for the purpose of symbolizing output raster layers, and no raster attribute table will be built.

Distance toolset

The Euclidean distance tools have a new parameter option, distance_method.  With the Geodesic option, the distances are calculated on the ellipsoid, which means that the results of the operation do not change regardless of the input or output projection.  The default Planar option will return the same result as in previous releases. The tools are: Euclidean Allocation (Pro | ArcMap), Euclidean Direction (Pro | ArcMap), and Euclidean Distance (Pro | ArcMap).

An improvement was made to the default behavior for a number of the Cost and Path distance tools.  The processing extent and spatial reference now default to that of the input cost raster.  This will improve the accuracy of the results, and better meets the expected behavior. What’s the reason behind this change?  Previously, the processing extent defaulted to the input source dataset, and since that is often smaller than that of the cost surface extent, the resulting cost paths were limited.  Now, the tools will return the true least-cost path between locations within the full extent of the cost surface.  The full list of the seven affected tools is: Cost Allocation (Pro | ArcMap), Cost Back Link (Pro | ArcMap), Cost Connectivity (Pro | ArcMap), Cost Distance (Pro | ArcMap), Path Distance (Pro | ArcMap), Path Distance Allocation (Pro | ArcMap), Path Distance Back Link (Pro | ArcMap).

Extraction toolset

For the Extract By Mask  (Pro | ArcMap) tool, the input raster will now be used as the default snap raster.  This improves the accuracy of the output by ensuring the correct alignment of the feature mask with the value raster. If both the input raster and the input mask are raster, by default the tool will use the input with the largest cells size as the cell size for the operation.  If the input mask is a feature, by default the input raster will define the cell size and snap raster environment for the operation.

Hydrology toolset

The Flow Accumulation (Pro | ArcMap) and Flow Distance (Pro | ArcMap) tools have a new optional parameter that allows you to specify which option was used to create the particular flow direction raster you are using as input for the tool.  The flow_direction_type raster parameter has the choices of D8 (the default method, which assigns the flow direction to the steepest downslope neighbor), MFD (this method assigns multiple flow directions towards all downslope neighbor), and DINF (this uses the D-Infinity flow method to assign flow direction based on the steepest slope of a triangular facet).

Segmentation and Classification toolset

The Export Training Data For Deep Learning (Pro | ArcMap) tool has a new optional parameter, start_index. This is useful when appending image chips to an existing sequence for training the deep learning classifier.

Surface toolset

The Contour (Pro | ArcMap) tool has two new parameters.  With contour_type, you can now choose to create contour output as polygons instead of just polylines.  There are several types of filled contours to choose from.  When contouring larger or complicated surfaces with polygons, you can use the max_vertices_per_feature parameter to control the maximum number of vertices per polygon feature.

Zonal toolset

For zonal tools that perform a zonal operation on an input value raster, that raster will be used as the default snap raster for the operation.  The benefit here is improved accuracy for the output due to the correct alignment of the feature zone with the value raster. The tools with this new default behavior are Zonal Histogram (Pro | ArcMap), Zonal Statistics (Pro | ArcMap), and Zonal Statistics as Table (Pro | ArcMap).

The Tabulate Area (Pro | ArcMap) tool has a new default behavior as well.  Now, when both the zone input and the class input are raster, the class raster will be used as the snap raster for the operation.  If one of these inputs is a raster and the other a feature, the one that is raster will be used for setting both the processing cell size and the snap raster.

 

2. Parallel Processing

As promised, the parallel processing capability that was added to a number of tools at ArcGIS 10.6 but not Pro 2.1 is now available for those tools in Pro 2.2!  We also enabled this capability for a few more tools for ArcGIS 10.6.1.

 

ArcGIS Pro 2.2

Distance toolset: Cost Allocation (Pro), Cost Back Link (Pro), Cost Distance (Pro), Euclidean Allocation (Pro), Euclidean Direction (Pro), Euclidean Distance (Pro), Path Distance (Pro), Path Distance Allocation (Pro), and Path Distance Back Link(Pro).

Generalization toolsetNibble (Pro)

Hydrology toolsetFill (Pro), Flow Accumulation (Pro), Flow Direction (Pro), Flow Distance (Pro), Sink (Pro), Stream Link (Pro), and Watershed (Pro).

 

ArcMap 10.6.1

Distance toolsetCost Back Link (ArcMap), Euclidean Direction (ArcMap), Path Distance (ArcMap), Path Distance Allocation (ArcMap), and Path Distance Back Link (ArcMap).

 

3. Raster Functions

Have you  been using Raster Functions to perform select raster operations on pixels displayed in your ArcGIS Pro map window?  There is a large number of operations you can use on your raster or imagery data out-of-the box, with more available when you have a Spatial Analyst or an Image Analyst extension license available.

Three new distance raster functions are available in Pro 2.2, Cost Back Link, Cost Path, and Euclidean Direction.

In addition, the Flow Accumulation and Flow Distance functions have the new flow direction type parameter.

 

Following is the current list of Raster functions you can use that require either a Spatial Analyst (SA) or an Image Analyst (IA) license in ArcGIS Pro. Which specific license(s) are required are identified.

Analysis Functions: Kernel Density (SA), Weighted Overlay (SA), Weighted Sum (SA, IA)

Classification Functions: Classify (SA, IA), ML Classify (SA, IA), Segment Mean Shift (SA, IA)

Data Management Functions: Nibble (SA)

Distance Functions : Cost Allocation, Cost Back Link, Cost Distance, Cost Path, Euclidean Allocation, Euclidean Direction, Euclidean Distance, Least Cost Path (All require SA)

Hydrology Functions: Fill, Flow Accumulation, Flow Direction, Flow Distance, Stream Link, Watershed. (All require SA)

Math : Abs, Divide, Exp, Exp10,  Exp2, Float, Int, Ln, Log10, Log2, Minus, Mod, Plus, Power, Round Down, Round Up, Square, Square Root, Times (All require either SA or IA)

Math : Conditional : Con (SA, IA), Set Null (SA, IA)

Math : Logical : Bitwise And, Bitwise Left Shift, Bitwise Not, Bitwise Or, Bitwise Right Shift, Bitwise XOr, Boolean And, Boolean Not, Boolean Or, Boolean XOr, Equal To, Greater Than, Greater Than Equal, Is Null, Less Than, Less Than Equal, Not Equal (All require either SA or IA)

Math : Trigonometric: ACos, ACosH, ASin, ASinH, ATan, ATan2, ATanH, Cos, CosH, Sin, SinH, Tan, TanH (All require SA or IA)

Statistical Functions: Cell Statistics (SA or IA), Zonal Statistics (SA or IA).

Surface Functions: Viewshed (SA).  Note, there are other surface functions, such as Aspect, Hillshade or Slope, that you can use without an Spatial Analyst or Image Analyst license.

 

4. Raster Analysis Tools in ArcGIS Pro

In ArcGIS Pro 2.2, one new Raster Analysis tool has been added, and two other tools have new parameter options.

Hydrology toolset

The Flow Accumulation and Flow Distance tools have a new parameter that allows you to specify the type of the input flow direction raster: D8, Multi Flow Direction (MFD), or D-Infinity (DINF).

Use Proximity toolset

The new Determine Travel Cost Path As Polyline tool is used to calculate the least cost path between sources and destinations.

 

Follow this link to see the full suite of functionality available in the Raster Analysis toolbox in ArcGIS Pro.

 

5. Raster Analysis in the Map Viewer

Some new tools are available for performing raster analysis in the Map Viewer when you are connected to an updated version of the Portal for ArcGIS in ArcGIS Enterprise.

There is a new toolset for proximity (distance) analysis, with the following three tools:

  • Calculate Distance
  • Determine Optimum Travel Cost Network
  • Determine Travel Cost Path As Polyline

In the Analyze Terrain toolset, there is a new Watershed tool.

New Map Viewer tools for Raster Analysis

Four new Map Viewer tools for Raster Analysis are available in this release

6. Raster Analysis in the REST API

The Determine Travel Cost Path as Polyline task was added to the ArcGIS REST API for 10.6.1.  This task can be used to calculate the least cost way to travel from the source location to a destination.

 

See Get started with the Raster Analysis service to learn more about using the REST API to execute other Raster Analysis service tasks, and how to configure your portal to enable the functionality.

 

Some background on raster analytics in ArcGIS Enterprise

Raster Analytics using ArcGIS Enterprise is a flexible raster processing, storage, and sharing system that employs distributed computing and storage technology based on ArcGIS Image Server.  The source data and processed results are stored, published, and shared across your enterprise as image and feature web layers,  according to your needs and priorities.

This capability can be further extended by leveraging cloud computing capabilities and resources. The net result is that raster processing and analysis on very large datasets, which heretofore were difficult to perform in a timely manner on single machines, can now be executed in short order by harnessing the compute power of multiple servers to simultaneously attack the tasks you give them.

In order to have access to Raster Analytics, you need to have an ArcGIS Enterprise deployment available.  After ArcGIS Server is installed, ArcGIS Image Server will also need to be installed and enabled.   Please see the following resources for more details on configuring and using these services for performing raster analysis.

 

Server

Portal

 

Summary

Above we’ve covered the important changes and improvements for raster analysis that have been introduced to the platform in ArcGIS Pro 2.2, ArcGIS Desktop 10.6.1, and ArcGIS Enterprise 10.6.1.  After you have downloaded the new versions, please give the new capabilities a try.  If you encounter any difficulties along the way, be sure to communicate them back to us through the Support channels or GeoNet, so we can work on resolving them.

When working with Zonal tools in the Spatial Analyst toolbox, have you occasionally gotten results that that you didn’t quite expect? Here we’ll cover a few scenarios where and why you might have run into some issues, how to work around them, and how things have changed in the latest release to avoid them in the first place. The Zonal Statistics tool calculates statistics on values of a raster within the zones defined by another dataset. To learn more, read How Zonal Statistics works.

The zone input can either be a feature or a raster. If the zones are defined by features, an internal feature to raster conversion will occur. The internal conversion for a polygon zone uses the cell center method to rasterize the input. With an analysis extent calculation method of intersection-of or union-of, the origin of the internal raster may be determined entirely by the feature class. Snapping is then performed relative to that origin: the internal raster origins at the lower-left corner of the analysis extent and its upper-right corner is adjusted by the cell size. The cells of the internal zone raster and the value raster may not align, which will trigger a resampling during the zonal operation. Resampling will also occur if the input zone is a raster with different cell size and/or alignment. Often times, we end up getting an unexpected result due to the feature to raster internal conversion or misalignment of the zone and value raster. Let’s look at some of these scenarios in detail:

 

1. Unexpected statistics values

The common source of unexpected statistics values is the misalignment of the cells of the zone and value rasters.

In this example in figure 1a below, you may expect the Zonal Statistics tool to compute the statistics based on the cells of the value raster whose cell center falls within the feature zone, which are values 79, 81 and 27. However, due to the way the default internal conversion will be performed based on the origin and extent, how the feature zone gets rasterized will create an unexpected output. As you can see in figure 1b the rasterization grid used for the internal conversion does not align with the value raster. Therefore, using the cell center method, the zone raster will end up analyzing a different set of cells from the value raster (see figure 1c) than you originally anticipated from figure 1a.

Figure 1: Internal conversion of feature zone without considering the value raster for cell alignment.

Figure 1: Internal conversion of feature zone without considering the value raster for cell alignment.

 

To avoid this issue, there is a step you can take to ensure that the feature zone being converted to a raster is aligned with the value raster. Simply set the snap raster to the value raster from the tool environment. The misalignment can also occur when the input zone is a raster, if the cell size and/or cell alignment does not align with the value raster. You can set the snap raster environment to the value raster to get the expected output.

Let’s look in the example below, in figure 2b, to understand how setting the snap raster to the value raster ensures the rasterization grid used for the internal conversion aligns with the value raster in figure 2b. As a result, the zone raster will analyze those cells from the value raster (see figure 2c) that you originally anticipated from figure 2a.

Figure 2: Internal conversion of feature zone considering the value raster for cell alignment.

 

The good news is that ArcGIS Pro 2.2 and ArcMap 10.6.1 use the value raster as the snap raster by default for internal conversion of the feature zones. If you are using a version prior to ArcGIS Pro 2.2 or ArcMap 10.6.1, specify the value raster as the snap raster in the environment.

 

2. Missing zones in the output

The most frequent cause of missing zones in the output occurs when the cell center of the rasterization grid does not fall within the feature zone. This can occur for zones that are smaller than the area of a cell of the internal zone raster or even for larger zones.

In the example below, let’s look at how rasterization occurs for zones of different size and location. Figure 3a has three zones, where, zone1 is larger than a cell, and zone2 and zone3 are smaller than a cell, and the cell center falls outside zone2 and within zone3. During the zone rasterization process in figure 3b, it so happens that no cell centers fall within zone1 and zone2, and only zone3 contains a cell center. Therefore, only zone3 will be rasterized and the other two zones will essentially disappear, as shown in figure 3c.

Figure 3: Internal conversion of feature zone leading to missing zones.

Figure 3: Internal conversion of feature zone leading to missing zones.

 

To avoid this, ensure that each of your zones contains one or more cell centers. You can create more cell centers by specifying a smaller cell size in the environment. The default analysis cell size comes from the value raster. Therefore, specifying a cell size that is smaller than that of the value raster will enable more zones to be captured.

For figure 4, let’s repeat the same example from figure 3 to see how changing cell size better captures all the zones. Similar to figure 3a, figure 4a also has three zones, where, zone1 is larger than a cell, and zone2 and zone3 are smaller than a cell but are spatially located differently. Figure 4b shows a finer rasterization grid based on a cell size that is four times smaller than the default cell size. During the zone rasterization process, multiple cell centers now fall within each of the zones. As a result, all the zones get rasterized as shown in figure 4c.

Keep in mind that specifying a smaller cell size, will generate a larger output raster.  In this example, the output raster will be sixteen times larger than the raster with default cell size. Even more important, the higher resolution output may give the wrong perception of a higher quality result than what it actually is, since the additional detail does not actually exist in the input value raster.

Figure 4: Internal conversion of feature zone with a smaller cell size capturing all zones.

 

Note: If you are using a version prior to ArcGIS Pro 2.2 or ArcMap 10.6.1, specify the value raster as the snap raster in the environment.

 

3. Other sources of unexpected result

You may also get unexpected results during the rasterization of feature zones if you have:

  • coincident points or multiple points on one cell
  • coincident polylines or multiple polylines passing through one cell
  • coincident polygons or partially overlapping polygons

Be sure to read the Zonal Statistics and How Zonal Statistics works help pages to learn more about how this tool works.

 

Summary

With the information presented here, you should be able to better understand how this tool operates, and how to guarantee better and more understandable results.  Keep in mind that there is a similar behavior in play for other Zonal tools, such as Tabulate Area, Zonal Histogram and Zonal Statistics as Table so you can employ the lessons learned here to achieve greater success with those tools, too. Keep in mind, that ArcGIS Pro 2.2 and ArcMap 10.6.1 now use the value raster as the snap raster by default for internal conversion of the feature zones. If you are using a version prior to ArcGIS Pro 2.2 or ArcMap 10.6.1, specify the value raster as the snap raster in the environment.

Let us know if you encounter other scenarios where you get an unexpected result while doing your analysis, or if you have any questions or comments. You can comment here or reach me at schatterjee@esri.com.

ArcGIS Pro SDK for .Net allows you to extend the ArcGIS Pro user interface by creating custom add-ins leveraging different GIS functionalities. In this blog, we will take a look at how to execute Spatial Analyst tools in your add-in using the ArcGIS Pro SDK.

How to execute a geoprocessing tool

The ArcGIS.Desktop.Core.Geoprocessing namespace in the SDK provides a Geoprocessing class to help execute a geoprocessing tool. The Geoprocessing class within the namespace offers necessary methods to specify the input parameters, set up environment settings, and execute the geoprocessing tool. The static method, ExecuteToolAsync is used to execute the tool.
The first argument for ExecuteToolAsync is the geoprocessing tool name as a string. To specify a tool uniquely, the tool name must be appended with its toolbox alias. For example, the Copy Features tool is in the data management toolbox, and the alias of the data management toolbox is management. Therefore, to execute the Copy Features tool, the tool name should be specified as CopyFeatures_management. Without the toolbox alias, or with a misspelled toolbox alias, an error will be returned and the tool will not be executed because the geoprocessing framework is not able to find the tool.
The second argument for ExecuteToolAsync is the tool parameter values array, which holds all the input and output parameter values for the geoprocessing tool. Do not create the array yourself. Simply call the method MakeValueArray, to create it, passing in all input and output parameter values as arguments.
Additionally, you may want to specify an environment setting for the tool execution. The third argument for ExecuteToolAsync allows you to do that. Like the input/output parameters, the environment settings also need to be specified in an array. Again, no need to create the array by yourself, simply call the method MakeEnvironmentArray to make one.
The rest of the arguments for ExecuteToolAsync are optional. As an asynchronous method, ExecuteToolAsync will start the geoprocessing tool execution in a different thread other than the user interface (UI) thread, which allows the ArcGIS Pro UI to remain active while the tool executes.

How to execute a Spatial Analyst tool

Executing a Spatial Analyst tool is no different than any other geoprocessing tool. All we need to do is supply a tool name with an appropriate toolbox alias, which is sa. The following example will walk you through a C# example on how to execute the Zonal Statistics tool to calculate average elevation for each zone, using SDK.

Let’s start by specifying the tool input and output parameters:

// declaring tool parameter variables
string inZoneRas = @"c:\data\county.tif" ; // input zone raster
string zoneField = "Value"; // zone field
string inValueRas = @"c:\data\elevation.tif" ; // input valueraster
string outRaster = @"c:\output\outzs01.tif" ; // output raster
string statType = "MEAN" ; // statistics type
bool ignoreNoData = true ; // ignore NoData option

Now let’s create the first array with the above parameter values using the Geoprocessing.MakeValueArray method:

// create an array for the input parameter values
var valueArray = Geoprocessing.MakeValueArray(inZoneRas, zoneField, inValueRas, outRaster, statType, ignoreNoData);

Next, create another array for environment settings using Geoprocessing.MakeEnvironmentArray to set the cell size for analysis and to overwrite output if it exists:

// create an array for the environment settings
var envArray = Geoprocessing.MakeEnvironmentArray(overwriteoutput: true, cellSize: 30);

Finally, let’s execute the tool by calling the ExecuteToolAsync method, passing in the tool name, the tool parameter values array, and the environment settings array that we created above. Notice that the tool name ‘ZonalStatistics’ is appended with its toolbox alias ‘sa’, which refers to the Spatial Analyst toolbox:

// run ZonalStatistics
var gpresult1 = await Geoprocessing.ExecuteToolAsync("ZonalStatistics_sa", valueArray, envArray);

Because the Spatial Analyst is an extension product, a license is required in order to use its capabilities. However, we did not enable the license in the preceding code snippet as in our case, it is enabled through the ArcGIS Pro application. If the Spatial Analyst license is not already enabled, the tool execution will fail with a licensing error. To enable the Spatial Analyst license, configure your licensing options from the ArcGIS Pro application.

How to execute a map algebra expression

Now that we have learned how to execute a Spatial Analyst tool using the ArcGIS Pro SDK, let’s look at another example. In raster modeling, we often need to execute map algebra expression to solve a complex problem. In the Spatial Analyst toolbox, the tool that allows us to execute map algebra expression is called Raster Calculator.
In your add-in, you may take advantage of the Raster Calculator tool to execute single-line map algebra expressions. The Raster Calculator tool has two parameters only. The first parameter is the map algebra expression itself. The second parameter is the output raster, which saves the result of the calculation.
In the example below, let’s build a map algebra expression to find the land uses for areas with slope greater than 30 degrees and aspect less than 120 degrees, and use the Raster Calculator tool to execute it.

First, let’s specify the input raster datasets that will be used in our map algebra expression:

// input raster datasets for the map algebra expression
string inRas1 = @"c:\data\in_slope.tif" ;
string inRas2 = @"c:\data\in_aspect.tif" ;
string inRas3 = @"c:\data\in_landuse.tif" ;

Now, let’s build the map algebra expression. Notice that the input raster datasets are embedded in the expression itself, enclosed by single quotation marks:

// define the map algebra expression
string maExpression = String.Format("Con((‘{0}’ > 30) & (‘{1}’ < 120), ‘{2}’)",inRas1, inRas2, inRas3);

We need another variable to specify the output raster:

// define the output raster
string outRaster = @"c:\output\outrascal01.tif" ;

Now we can create an array using maExpression and outRaster:

// make the input parameter values array
var valueArray = Geoprocessing.MakeValueArray(maExpression, outRaster);

Finally, we kick off the Raster Calculator tool, which will execute the map algebra expression and save the result in outRaster:

// execute the Raster calculator tool to process the map algebra expression
var gpresult1 = await Geoprocessing.ExecuteToolAsync("RasterCalculator_sa", valueArray);

Summary

Now that you are comfortable executing Spatial Analyst tools and map algebra expressions, you can perform raster modeling in your add-ins. If you need more information, check out our help pages on ArcGIS Pro SDK and ArcGIS Pro Spatial Analyst.

The 2018 Esri User Conference (July 9-13) is almost here – are you ready?  We here on the Spatial Analyst team are busy practicing and polishing our presentations, and are looking forward to showing you what we’ve been working on since last summer.  If you do any kind of raster or imagery analysis, or do multidimensional analysis, please look at the guide below to help you plan out your time with us.

To help target your areas of interest, we’ve categorized things into several groupings. Each one will list out a general purpose of the grouping, followed by the specific session titles in chronological order.  Repeat presentations are also listed, in case you are not able to attend the first showing.

  1. Introduction to Raster Analysis
  2. Applied Raster Analysis
  3. Imagery
  4. Raster Analytics
  5. Python
  6. Multidimensional and Scientific data
  7. Road Ahead

See the full agenda for more details on these sessions, and more. Be sure to download the Esri Events Mobile App too!   (UC content coming soon)

Please come by the Island in the Showcase during the week (Tuesday and Wednesday from 9 – 6, and Thursday from  9 – 1:30).  We’d love to hear about the work you do, any difficulties you encounter, and any ideas you might have to make our software suit your needs even better.

Finally, remember to check out the Spatial Analysis : The Road Ahead session for a peek into the future.

 

1. Introduction to Raster Analysis with Spatial Analyst

The ArcGIS Spatial Analyst extension offers a large number of spatial modeling and analysis tools.  The following sessions cover many aspects of this product.  The introductory sessions demonstrate the wide range of capabilities on offer.  The Map Algebra session introduces the simple and powerful language that Spatial Analyst uses for performing a wide range of raster and feature geographic analysis. Following that are more focused sessions on specific aspects of the capabilities, such as suitability modeling, cost distance modeling, and interpolating surfaces from vector data.

Spatial Analyst: An Introduction

Tue, July 108:30 am – 9:30 amTech WorkshopSDCC – Room 29 D
Tue, July 104:00 pm – 5:00 pmTech WorkshopSDCC – Room 29 D

Map Algebra: Getting Started  

Tue, July 1010:00 am – 10:45 amDemoDemo Theater 10

Finding the Best Locations Using Suitability Modeling 

Tue, July 102:30 pm – 3:30 pmTech WorkshopSDCC – Room 30 D
Wed, July 111:00 pm – 2:00 pmTech WorkshopSDCC – Room 29 D

Cost Distance Analysis: Identifying the Best Path

Wed, July 118:30 am – 9:30 amTech WorkshopSDCC – Room 29 C
Thu, July 12  4:00 pm –   5:00 pmTech WorkshopSDCC – Room 29 C

Interpolating Surfaces in ArcGIS

Wed, July 1110:00 am – 11:00 amTech WorkshopSDCC – Room 30 C
Thu, July 124:00 pm – 5:00 pmTech WorkshopSDCC – Room 31 A

Surface Interpolation in ArcGIS

Wed, July 1111:15 am – 12:00 pmDemoDemo Theater 10

 

2. Applied Analysis

If you are interested in learning more about applied raster analysis capabilities offered by ArcGIS, the following sessions will be of interest to you.  Hydrological modelling is one of the specific applications for which raster-based processing is most highly suited.  Attend these sessions to learn more about creating hydro-conditioned surfaces, watershed delineation, stream flow calculation, flood modeling, and flood impact assessment.  Also included in this group is a session on applied suitability modelling, in particular, the workflow used to identify the best habitat patches for bobcat, and how to connect them with the optimum network of wildlife corridors

HydroGIS 2018 – Forecasting and Response for Flows and Floods

Sun, July 88:30 am – 5:00 pmFree preconference WorkshopSDCC – Room 29 D

 Creating a Hydro Conditioned DEM

Wed, July 118:30 am – 9:30 amTech WorkshopSDCC – Room 30 A
Wed, July 114:00 pm – 5:00 pmTech WorkshopSDCC – Room 30 A

Hydrologic and Hydraulic Modeling in ArcGIS

Wed, July 1110:00 am – 11:00 amTech WorkshopSDCC – Room 29 D
Thu, July 124:00 pm – 5:00 pmTech WorkshopSDCC – Room 30 A

GIS Techniques for Floodplain Delineation

Wed, July 111:15 pm – 02:00 pmDemoDemo Theater 10

 Bobcat Suitability Modeling 

Thu, July 1212:15 pm – 1:00 pmDemoDemo Theater 10

 

3. Raster Analytics with Image Server

The ArcGIS Enterprise Image Server can be used for quickly processing very large collections of raster and imagery data. The following sessions will introduce the capabilities of this product, describe the architecture, detail the deployment options, and identify the performance benefits offered by distributed processing.

ArcGIS Enterprise: Raster Analytics in Image Server

Wed, July 1110:00 am – 11:00 amTech WorkshopSDCC – Room 01 A/B
Thu, July 1210:00 am – 11:00 amTech WorkshopSDCC – Ballroom 06 F

ArcGIS Enterprise: Building Raster Analytics Workflows

Wed, July 11 1:00 pm – 2:00 pmTech WorkshopSDCC – Room 31 A

ArcGIS Enterprise: Deploying Distributed Raster Analytics

Thu, July 12 1:00 pm – 2:00 pmTech WorkshopSDCC – Room 30 E

 

4. Imagery and Image Analyst

Whether your data comes from satellite imagery, aerial imagery, or drones, ArcGIS provides extensive capabilities for imagery management, visualization and analysis.  See the following list of sessions if you want to find out more about imagery collection, processing, display, classification, interpretation and information extraction.

Advanced Raster Analytics

Sun, July 82:15 pm – 3:00 pmImagery SummitMarriott – Grand Ballroom 5
Sun, July 84:15 am – 5:00 pmImagery SummitMarriott – Grand Ballroom 5

Imagery in ArcGIS: What’s New 

Tue, July 108:30 am – 9:30 amTech WorkshopSDCC – Rm 07 A/B
Thu, July 122:30 pm – 3:20 pmTech WorkshopSDCC – Rm 32 A/B

 ArcGIS Pro: Introduction to Image Analyst Extension

Tue, July 1010:00 am – 11:00 amTech WorkshopSDCC – Room 03
Tue, July 104:00 pm – 5:00 pmTech WorkshopSDCC – Ballroom 06 F

ArcGIS Pro: Image Segmentation, Classification, and Machine Learning

Tue, July 10 1:00 pm – 2:00 pmTech WorkshopSDCC – Room 17 B
Thu, July 12 1:00 pm – 2:00 pmTech WorkshopSDCC – Room 15 A

Image Analysis and Visualization using the Web Map Viewer

Tue, July 101:15 pm – 2:00 pmDemoDemo Theater 01

ArcGIS Enterprise: Managing and Serving Imagery in the Cloud Using ArcGIS Image Server

Tue, July 10 2:30 pm – 3:30 pmTech WorkshopSDCC – Room 04
Thu, July 12 10:00 am – 11:00 amTech WorkshopSDCC – Room 02

How Raster Functions Revolutionized the World Population Estimate

Wed, July 1110:00 am – 10:45 amDemoDemo Theater 11

Image Processing using Raster Functions    (Intermediate)

Wed, July 112:30 pm – 3:15 pmDemoDemo Theater 01

 

5. Raster and Image Analysis with Python

Python offers a powerful way to perform raster and image analysis in ArcGIS.  The integration of Map Algebra with Python via the Spatial Analyst ArcPy module offers a broad range of capabilities for raster analysis and automation of geoprocessing workflows. If you like NumPy, we’ve got that covered too!

With the raster module of the ArcGIS API for Python, you can derive information from raster imagery with the large number of available raster functions. As the datasets continue to get larger and larger, learn about how parallel processing, distributed processing and the ArcGIS Image Server can be used to optimize performance.

Python: Raster Analysis

Tue, July 101:00 pm – 2:00 pmTech WorkshopSDCC – Room 31 C
Thu, July 122:30 pm – 3:30 pmTech WorkshopSDCC – Room 03

ArcGIS API for Python: Image Analysis 

Thu, July 1210:00am – 11:00 amTech WorkshopSDCC – Room 16 A

 

6. Scientific and Multidimensional data

Scientific and multidimensional data is a burgeoning area of growth in GIS.  The ArcGIS platform has great capabilities for supporting the import, management, visualization, analysis and sharing of this type of information.  If you would like to use netCDF, HDF or GRID data for global scale spatial and temporal analysis, the following sessions will be of interest to you.

Scientific Tools for Atmospheric and Climate Analysis

Sun, July 088:30 am – 5:00 pmPreconferenceSDCC – Room 30 D

Working with Scientific Data in ArcGIS

Tue, July 101:00 pm – 1:20 pmShowcaseSDCC – Interoperability and Standards Spotlight Theater

Scientific and Multidimensional Raster Support in ArcGIS

Wed, July 118:30am – 9:30amTech WorkshopSDCC – Room 31 B

Analyzing Multidimensional Scientific Data in ArcGIS 

Wed, July 111:00 pm – 2:00 pmTech WorkshopSDCC – Room 30 E

 

7. The Road Ahead

Come join us for this Road Ahead session to find out what enhancements have been made in ArcGIS Spatial Analysis and what we are planning for the upcoming year, especially in the areas of machine learning, big data, real time analysis, and integrating spatial analysis with the scientific Python ecosystem.

Spatial Analysis: The Road Ahead

Wed, July 111:00 pm – 2:00 pmTech WorkshopSDCC – Ballroom 06 B
Fri, July 13  9:00 am –  10:00 amTech WorkshopSDCC – Room 05 A

With growing raster dataset sizes, the processing times for analysis are becoming longer and longer. By employing concepts from parallel and distributed computing, we can improve performance and scalability of workflows with Spatial Analyst tools. For some tools, Spatial Analyst offers enhanced performance with built-in parallel processing capability. These tools use the multi-core processors on modern computing hardware to complete processing tasks more quickly. Additionally, the ArcGIS Image Server provides capabilities for scalable distributed raster analysis and distributed storage of large image and raster collections. However, built-in capabilities are not yet available across all Spatial Analyst tools. In this blog, we will identify scenarios where the multiprocessing Python module (Python.org) can be used to optimize performance of raster analysis workflows by dividing up the work between multiple processes on a given machine. We will identify candidate raster operations that benefit most from parallel computation and learn how to develop efficient parallel systems for raster geoprocessing within the robust Python environment.

 

Candidate raster operations for parallelization can be broadly classified into three geoprocessing scenarios. Parallelism is invoked using a different mechanism for each scenario.
 Processing a large raster dataset with a single analysis tool
 Batch processing a collection of raster datasets by running a single analysis tool multiple times
• Raster geoprocessing workflow by running suitable analysis tools chained together

 

From our in-house testing, we evaluated the performance of a local operation executed parallelly on a large sample dataset. The graph below summarizes the performance improvements that were observed.

 

The advantages of optimizing raster analysis tasks with Python multiprocessing are evident from this graph. We can see significant improvements while adding more processes to help with the analysis, especially going from one to four processes. Beyond that, gains were negligible due to the overhead of spawning multiple processes.

 

Processing a large raster dataset

The increase in resolution of raster datasets has led to larger and larger data sizes. Currently, datasets are on the order of gigabytes and increasing, with billions of raster cells. While computing power of the processors and size of the memory in computers have increased appreciably, legacy equipment and algorithms suited to manipulating small rasters with coarser resolution make processing these improved data sources costly. [1]

 

Data decomposition, also known as divide and conquer, is a popular strategy used in parallel computing that we will take advantage of to parallelly process a large raster dataset. The algorithms used in raster analysis tools can be broadly classified into four categories – local, focal, zonal and global operations. For a deeper dive into the types of cell-based raster operations, read this article. Local, focal and zonal raster operations are simple to program with when it comes to data decomposition. Once the data is decomposed appropriately, each data ‘chunk’ can be operated on independently on by a process without the need to communicate with other processes. However, global raster operations are tougher to integrate with data decomposition and require communication between processes. Let us look at an example of processing a large raster dataset using a local math raster operation, Square Root. The Local, or per-cell operations, are the simplest to parallelize using a ‘divide and conquer’ strategy, since the resulting value at each cell only depends on the input value at that cell location. For each cell, the Square Root tool calculates the square root of the value from that cell. Using the tool serially would mean simply running the Square Root tool on the entire large dataset, but, this process can be time consuming.

 

Default, non-optimized serial approach to processing a large raster

 

Instead, through data decomposition, we can redesign the analysis task to utilize multiple worker processes simultaneously, thus improving the performance of the overall analysis. The graphic below depicts splitting the domain of a large raster into several smaller chunks, and using multiple worker processes to simultaneously perform analysis on each of the sub-sections. The results are then stitched back together for the final output.

 

Multiprocessing large rasters parallelly

 

A sample script is shared on GitHub here that goes in depth on how this problem can be solved programmatically using ArcGIS Desktop and the Python multiprocessing module.

 

Batch processing a collection of raster datasets

When it comes to batch processing many datasets through a raster analysis tool, the common approach would be to use an iterator in ModelBuilder or write a Python script with a loop to iterate over each dataset in the batch and process them serially. This method can be time consuming when working with a large collection of rasters, particularly when running analysis tasks that have significant compute times.

 

Default sequential approach to processing a multiple rasters

 

Parallelism is a straightforward mechanism for batch processing when the analysis of each dataset in the batch can be performed independently from the rest. From the graphic below we can see how multiple processes working simultaneously enable faster processing of the batch queue.

 

Using multiprocessing to efficiently process multiple rasters in a parallel fashion

 

A sample script is shared on GitHub here that describes in detail how batch processing can be solved programmatically using ArcGIS Desktop and the Python multiprocessing module.

 

Raster geoprocessing workflows

A geoprocessing workflow is a multiple-step procedure that combines geoprocessing tools and geographic data to produce a meaningful result. Within ArcGIS, raster geoprocessing workflows can be written as models using ModelBuilder or as Python scripts. The standard approach in either cases is to chain together the tools needed to perform your analysis and execute them serially. Let us look at an example workflow that assesses a suitability raster by running the Slope, Aspect, Reclassify and Weighted Sum tools. These tools are available as part of the Spatial Analyst Extension in ArcGIS Desktop.

 

Default approach to performing a workflow

 

In the above example, as tools are executed in a serial fashion, only one worker process can be utilized at a time to complete the workflow. To parallelize any geoprocessing workflow, the first task is to decompose the problem and identify parts of it that may be handled independently. This workflow is a good candidate for parallel processing as the execution of Slope, Aspect and Reclassify tools are independent tasks. These tasks have no dependencies on the execution of other tools in the workflow. However, the Weighted Sum tool is a dependent task, having dependencies on the outputs from the Slope, Aspect and Reclassify tools. Until the Slope, Aspect and Reclassify tools have finished executing, the Weighted Sum tool cannot begin its analysis. Having identified the independent and dependent tasks within this workflow, we can redesign this problem to parallelize it.

 

Incorporating parallel processing into model workflows

 

In this redesigned workflow, we are making use of multiple worker processes to execute independent tasks simultaneously, rather than depend on a single worker to process each task serially.

Best practices and considerations

There are many factors to consider while combining the capabilities of the arcpy and multiprocessing modules to improve performance of raster geoprocessing tasks.

 

• There are always overheads associated with spawning multiple processes that must be accounted for when considering a parallelized approach. In situations where the processing task is complex, and the processing data is large or the batch size is huge, parallelism can provide performance benefits that outweigh the overhead. In other situations, such as when the processing task is very simple, or if the processing datasets were not particularly large, it may be that utilizing multiprocessing does not provide any significant performance benefit and, in some cases, slows down overall processing speed. As parallelizing your code can be tedious, you should consider the end goal and opportunity cost of investing time in parallelization. For a task that is run repetitively, say on a scheduled basis, and in big data processing, parallelization can be advantageous.

 

• Avoid writing output rasters from multiple processes to a common File Geodatabase (FGDB) or to multiple Esri Grid rasters within a common folder workspace. These output formats often experience schema locks or synchronization issues when accessed by multiple simultaneous processes.

 

• You are encouraged to use ArcGIS Pro, ArcGIS Server or ArcMap with ArcGIS for Desktop Background Geoprocessing (64-bit) for parallelized raster analysis. Using 64-bit processing to perform analysis on systems with large amounts of RAM may help with processing large data efficiently.

Looking Ahead

The Spatial Analyst development team continues to work on parallelizing and distributing additional tools to further improve performance and scalability. Be on the lookout for these enhancements with future releases of ArcGIS Desktop, ArcGIS Pro and ArcGIS Image Server!

References

[1] Barnes, Lehman, Mulla. “Priority-Flood: An Optimal Depression-Filling and Watershed-Labeling Algorithm for Digital Elevation Models”. Computers & Geosciences. Vol 62, Jan 2014, pp 117-127, doi: ”10.1016/j.cageo.2013.04.024”.

For the Spline with Barriers interpolation tool, the enhancements that were made when the tool was implemented in ArcGIS Pro 2.0 are now also available in ArcGIS 10.6. Let’s have a look at the history of this tool, and some example applications.

Tool History

The Spline with Barriers tool was first implemented in ArcGIS more than ten years ago.  It was included in the Spatial Analyst and 3D Analyst toolboxes initially as a script tool which called a Java library that performed the interpolation.  The tool was not included in the initial release of ArcGIS Pro.  However, for ArcGIS Pro 2.0 the tool was rewritten in C++ with some optimizations and bug fixes. This improved C++ implementation is now also available in ArcGIS 10.6, and has replaced the older Java implementation.

Applications

Often we have a variable that is spatially not continuous and we want to use interpolation to produce an output raster that has values everywhere. For example, soil characteristics, or water quality in a braided meandering stream. In these cases you can use Spline with Barriers and specify either a polygon or polyline feature class to define the boundary of the discontinuity.

Methods and comparisons

Spatial Analyst and 3D Analyst have two interpolation methods that have an optional barrier input, those being IDW and Spline with Barriers.

The main difference between IDW and Spline with Barriers, other than the algorithm, is the way in which the points that are to be used in the interpolation are defined. IDW uses a “line of sight” approach, which means that if a point can’t be “seen” because of a barrier, then it is not used to make the prediction at that particular location. Spline with Barriers, on the other hand, weights the points based on the shortest distance around a barrier. In the illustration below, IDW (on the left) will only use 3 points to make a prediction when a barrier intervenes. In contrast, Spline with Barriers will utilize all 4 points to make the prediction.

Figure 1: Searching neighborhood for IDW (left) and Spline with Barriers (right) when using a barrier.

Figure 1: Searching neighborhood for IDW (left) and Spline with Barriers (right) when using a barrier.

Case Study

As an example, we’ll use the same case study described in Creating Faulted Geologic Surfaces with ArcGIS by Mike Price in the ArcUser Summer 2014 issue. In this article, the Spline with Barriers tool (the original Java version) is used.

We’ll use the point feature class, which contains the depth to the top of the Mississippian Leadville Limestone, and a polyline feature class defining the subsurface faults, to create an output depth raster with a cell size of 5 meters.

Figure 2: The geoprocessing tool dialog is on the left. To the right is the output depth raster, with the input points and barrier layers displayed on top.

Figure 2: The geoprocessing tool dialog is on the left. To the right is the output depth raster, with the input points and barrier layers displayed on top.

Figure 3: The output depth raster displayed in a 3D perspective view.  Note the steps created by the barriers.

Figure 3: The output depth raster displayed in a 3D perspective view. Note the steps created by the barriers.

We often rely on contour lines to aid our interpretation of an interpolated surface. However, in the vicinity of fault lines there may be abrupt changes in the depth values between some adjacent raster cells.  As a result, we cannot use the standard Contour tool as it will incorrectly produce many contours in these areas. The Contour with Barrierstool is well suited for this type of data as illustrated in the images above.

Conclusion

This exercise shows how to model the elevation of the top of the Mississippian limestone in Lisbon Valley, Utah, using only formation top elevations and fault barriers to generate a reliable predictive elevation surface.

When using a geoprocessing tool, for example Hillshade, when you specify an extent in the environment settings, you might have noticed sometimes that your output raster is slightly larger than your specified extent. Ever wondered what is going on inside the box? Let’s find out what triggers that effect.

The Extent environment controls where the raster analysis occurs, which means that the tools that honor this environment will only process the raster cells that fall within the extent. When you specify an extent in the environment, the lower-left corner of the specified extent will automatically become the lower-left corner of the output raster, unless you have also specified a Snap Raster environment. From here, the upper-right corner of the output raster is adjusted in such a way that the specified extent falls within your output raster. Whether the upper-right corner will be adjusted or not is determined by the output cell size, and the width and the height of the output raster extent are multiples of the output cell size. The end result is that the extent of the actual output raster can be slightly larger than what you specified in the extent environment.

Adjusted output raster extent

If the lower-left corner of the extent does not match with any cell corner of the input raster, it will create a shift in the cell alignment between the input and the output raster. This difference of cell alignment will trigger a resampling of the input raster to perform analysis.  Most Spatial Analyst tools use a nearest neighbor resampling technique, except for the Surface tools, which use bilinear interpolation.

You can avoid getting this shift in cell alignment and resampling by specifying a Snap Raster to your input raster in the environment setting.  To know more about Snap Raster, read How the Snap Raster environment setting works.

Check out the new ArcGIS Lesson on Predict Floods with Unit Hydrographs to create a unit hydrograph for a small to medium sized watershed using ArcGIS Pro, using a wide array of tools from Hydrology, Surface  and other toolsets from the Spatial Analyst Extension.

A unit hydrograph, when combined with a rainfall-runoff model, can be a powerful tool in predicting floods. They are relatively easy-to-use tools for quantifying the effects of rainfall on a watershed, and can be used to obtain a reasonable approximation of the flood response of natural watersheds.

A raster of Flow times for the town of Stowe, Vermont

A raster of Flow times for the town of Stowe, Vermont

This lesson is divided into 5 parts, where you begin with preconditioning the elevation model to delineate a watershed. The workflow is then refined to create a velocity field to determine how fast water flows with a spatially variant, time- and discharge-invariant velocity field. Finally, an isochrone map is created to assess the time it takes the water to follow the flow path, and the unit hydrograph is generated at the outlet to predict flooding. You may download the data and follow the complete workflow to go through this analysis.

Have you tried the new Interactive feature input capability in ArcGIS Pro 2.0 yet?  Read on to learn more about how you can perform analysis interactively with some of the Spatial Analyst tools.

 

Interactive feature input has been added to a number of geoprocessing tools in ArcGIS Pro 2.0, including certain Spatial Analyst tools that can process feature data. Depending on the type of features supported by a particular tool, you have the option to interactively create points, lines, polygons or 3D multipatches. This cool functionality lets you draw input features interactively on the map, and these features then become inputs to your tool.

Let’s go through an example to see how we can create polygon zones to summarize a raster using the Zonal Statistics as Table tool.

With the tool dialog box open, start by clicking the pencil, then select Polygons from the drop-down.

Once you select Polygons, a default polygon drawing tool will be activated and you can start drawing the polygon on the map, or you can choose from a palette of different editing tool used to digitize a polygon, including irregular polygons, autocomplete polygons, right-angle polygons, circles, squares, etc.

Now start drawing the features. For this example, I am comparing Seafloor Dissolved Oxygen (ml/l) at the coastline on both sides of the Gulf of California, and I have chosen the free shape polygon to digitize the zones.

After you finish drawing the polygons on the map, clear selection from the last created feature. Go to the Edit ribbon, select Clear. If you do not clear the selection, the analysis will run only on the last selected feature.

For Zonal Statistics as Table, we need an attribute to uniquely identify each zone. Open the attribute table of the zone polygon layer you just created. You will notice that it already comes with some default fields of different types. We are going to use the ‘Integer Value’ field for the analysis, so will enter a value for each of the polygons, and then save the table.

In the tool, use the ‘Integer Value’ field as the Zone field. Populate the rest of the parameters, specify the output and run with the ‘All’ Statistics type. The output table should appear something like below.

From this example, you learned about using the interactive features input capability in the Zonal Statistics as Table tool.

Apart from Zonal Statistics as Table, Interactive Feature Input is also supported in the following Spatial Analyst tools, grouped by toolset:

  • Distance: Cost Allocation, Cost Back Link, Cost Connectivity, Cost Distance, Cost Path, Euclidean Allocation, Euclidean Direction, Euclidean Distance, Path Distance, Path Distance Allocation, Path Distance Back Link
  • Extraction: Extract by Mask, Extract Multi Values to Points, Extract Values to Points, Sample
  • Hydrology: Snap Pour Point, Watershed
  • Interpolation: IDW, Spline with Barriers
  • Multivariate: Create Signatures
  • Solar Radiation: Points Solar Radiation, Solar Radiation Graphics
  • Surface: Observer Points, Viewshed, Viewshed 2, Visibility
  • Zonal: Tabulate Area, Zonal Geometry, Zonal Geometry as Table, Zonal Histogram and Zonal Statistics.

Now that you know how to use the interactive features, let’s recap a few things:

  • Select the appropriate feature type (points, lines, polygons) from the interactive feature drop-down menu that is supported by the tool parameter. Multipatch is not supported by any of the Spatial Analyst tools, so the tool would fail if it is selected.
  • After drawing some features clear the selection from the last created feature, so that all features are used in the analysis.
  • If the tool requires any attribute to perform the analysis, add the attribute and save it. If you do not add attribute information and specify the field, the tool would either execute on the ObjectId or on some other field, depending on the default tool behavior. If the particular field chosen for your analysis contain null values, the tool would fail to execute.
  • Pick the correct attribute field for executing your tool. Some tools like Zonal Statistics and Zonal Statistics as Table would fail if you do not specify the field on which you want to do the analysis.

To learn more about using interactive feature input with geoprocessing tools, explore the help documentation here. Additionally you can also explore a recent blog post, Streamline Your ArcGIS Pro Geoprocessing Workflows with Interactive Feature Inputs to gain further insights on interactive feature input.

The ArcGIS Spatial Analyst extension provides a broad range of powerful spatial modeling and analysis capabilities, like distance analysis, suitability modeling, terrain analysis, surface modeling, surface interpolation, hydrological analysis, and image classification. You can create, query, map, and analyze raster data; derive new information from existing data and perform integrated raster/vector analysis. Listed below are some resources to help you learn more.

Share your questions and awesome analysis stories with us here at the Geonet Spatial Analyst Forum— We’d love to hear from you! 

 

What’s New?

  • Resolution preserving cell size projection method (Help, How it works, Blog)
  • GPU processing with Spatial Analyst (Help)
  • What’s New for Spatial Analyst in ArcGIS Pro 2.2 and ArcMap 10.6.1 (Blog)
  • What’s New for Spatial Analyst in ArcGIS Pro 2.1 and ArcMap 10.6. (Blog)
  • What’s New for Spatial Analyst in ArcGIS Pro 2.0 and 10.5.1 (Blog)

 

New to Spatial Analyst? Start here:

  • Getting started with Spatial Analyst (Technical Workshop)
  • ArcGIS Spatial Analyst Tutorial (Help)
  • Overview of the ArcGIS Spatial Analyst Toolbox (Help)
  • Analysis environments and Spatial Analyst (Help)

 

Performing analysis with Spatial Analyst 

Suitability modeling

  • Finding the Best Locations Using the Suitability Modeling (Technical Workshop)
  • Understanding the suitability modeling workflow (Case Study)
  • Where are the best locations for a golf resort? (Case Study)
  • Build a Model to Connect Mountain Lion Habitat (Learn ArcGIS Lesson)
  • Finding Optimal Locations: Suitability Modeling in ArcGIS Pro (Training)

Distance analysis

Surface interpolation

Hydrological analysis

Image classification

  • Raster Classification with ArcGIS Desktop (Technical Workshop)
  • Finding the Best Paths for Rovers and Humans on Mars (Esri News)
  • Impervious Surface Mapping using Pro 1.4 – Part 1: Georeferencing (Blog)
  • Impervious Surface Mapping Using Pro 1.4 – Part 2: Classification (Blog)
  • Hands-on experience with the Image Classification Wizard ArcGIS Pro 1.3 (Blog)
  • Pass the classification but hold the salt and pepper (Blog)

Python for Analysis

Integrating different workflows together

  • Aloha! A GIS vacation (Case Study)
  • Minimizing the environmental impact of wind farm installation (Case Study)

Extending analytical capability using script tools

  • Introducing the Storage Capacity Supplementary Tool (Blog)
  • Supplementary Spatial Analyst Toolbox for ArcGIS 10.x. (Blog, Download)

 

Blogs

 

Readily Available Data

Esri Conference Presentations at a glance!

Suggested Books

Harder, C. (2015). The ArcGIS Book: 10 Big Ideas about Applying Geography to Your World. Esri Press.

Mitchell, A. (2012). The ESRI Guide to GIS Analysis Volume 3; Modeling Suitability Movement and Interaction. Esri Press.

 

Last updated: 05/08/2019

The original resource blog is located here.

It was great to interact with all of you at the User Conference in San Diego. Thank you for sharing your analysis stories, and for your feedback and suggestions. For those of you who could not make it to a particular session or would like to brush up a technical workshop you attended, here is a list of all the presentations that covered raster analysis that you can refer to. Keep us posted on your questions and suggestions.

Raster Analysis

Applied Analysis

Python for Analysis

Related workshops from 2017 International Developer Summit on Python for Raster analysis:

Other 2017 Esri User Conference paper sessions and technical workshop material can be found here. We look forward to seeing you next year!