This tool creates a table or a point feature class that shows the values of cells from a raster or set of rasters, for defined locations. The locations are defined by raster cells, polygon features, polyline features, or by a set of points.
Note:
This tool is now available in Map Viewer, the modern map-making tool in ArcGIS Online. To learn more, see Sample (Map Viewer).
If you do not see this tool in Map Viewer Classic, contact your organization administrator. Your account must have a Professional, or Professional Plus user type and the Imagery Analysis privilege
Workflow diagram
Examples
Some example applications of this tool include the following:
- Extract attributes for cell tower location from multiple rasters, such as land use, soil type, elevation, and distance to road.
- Extract soil temperature at different depths for a given set of points.
- From 30 years of monthly sea-surface temperature data, summarize at animal locations or within home ranges for a given time when an animal species was observed.
Usage notes
Cell values will be extracted from all input rasters at each location. A table or a point feature class will be created with fields containing the pixel values for each input raster. Additional attributes from the input raster table will not be included in the output table.
Any combination of rasters, such as single band, multiband, multidimensional, or multivariate, can be specified as input rasters. The structure of the output table changes when the input rasters are multidimensional. When a multiband raster is specified as one of the input rasters, all of the bands in that input will be used. To process a selection of bands from an input multiband raster, first create a raster dataset composed of those particular bands. Use the result in the list of input rasters.
The input location can be a raster or feature:
- Raster—Pixels containing valid values (not NoData) are used to extract the pixel values from all input rasters, and the center of the pixel is used for point locations.
- Point—Values will be sampled at each point location.
- Polyline or a polygon—Values will be sampled at the polygon or polyline centroid. If the input raster is multidimensional, the values will be aggregated based on the Statistics type.
A field will be added to the output table to store the values specified in the Specify unique ID field parameter. By default, the name of the field is the same as the input location dataset name. It is recommended that you use a field containing unique values as the identifier for each location for further analysis.
Locations that extract values from NoData cells in the input raster will be given a <null> value in the output table.
The input rasters are sampled in their native spatial reference and resolution. If there are multiple input rasters with different spatial references, the input locations are projected to each individual raster's spatial reference from which values are extracted. The analysis environment is applied to the input locations, but the input rasters will not honor the analysis environment.
The spatial reference of the x,y coordinates in the output sample table or feature class are the same as the input location raster or point features, unless it is specified in the Output Coordinate System environment. If the spatial reference of the input locations data is unknown, the spatial reference of the x,y coordinates is also unknown. If the input location is a point feature class with no spatial index, a warning will be issued. To improve tool performance for an input with a large number of points, create a spatial index.
To perform analysis with multipoint features, first convert them to single-point features before using them in this tool.
The Specify acquisition information of location data parameter will be used to specify the subset of the input multidimensional raster to use for sampling.
- When dimension, start value, and end value are specified, the slices within the start and end values are processed. The default end value is the maximum dimension value. For a time dimension, specify the value in the standard format. For other dimensions, specify the value in the same unit as that of the input raster.
- When dimension, start field, and end field are specified (start field and end field come from the location data), values from these fields are used to specify a subset of the input raster while sampling values at that location.
- The Relative value or days before and Relative value or days after values can be used to specify a subset relative to the start value, in which the before value specifies the beginning of the subset and the after value specifies the end of the subset. The time values are specified in days and the other dimension values are specified in the same unit as that of the input raster.
The Choose statistic type parameter aggregates the values of the Input raster parameter as specified by the subset in the Specify acquisition information of location data parameter.
If Sampled values appear in row is selected, the extracted values are stored in a field with the same name as the variable. Additional fields are created to store the nonspatial dimension values with the same name as the dimension. If Sampled values appear in column is selected, the extracted values are stored in fields with names that follow a <variable_name>_<dimension_name>_<dimension_value> convention.
If the multidimensional raster has multiple bands, an additional field is created for each band, which stores the value extracted from that band.
When the Specify resampling technique parameter is set to Nearest, the field type in the output table will match that of the raster type. When the resampling option is Bilinear or Cubic, the field type will always be floating point to maintain the precision of the interpolated values.
By default, the output is Table. If Specify output type is selected as Features, the output is a point feature class with the sampled values in its attribute table. The following are the possible location types with descriptions of how the values will be sampled:
- Raster—Points will be created using the location of the cell center.
- Point—A point will be created at each of the point locations.
- Polyline or polygon—A point will be created at each polygon or polyline centroid.
The spatial reference of the output feature class is the same as that of the Input location raster or features, unless it is specified in the Output Coordinate System environment.
The Parallel Processing Factor environment is only supported when the input is a multidimensional raster.
If a feature is specified in the Mask environment, an internal raster is created using the minimum cell size of the input rasters. During extraction, the internal mask raster is again resampled to the cell size of each input raster.
If Use current map extent is checked, variables or bands of the layer that are visible within the current map extent will be analyzed. If unchecked, variables or bands of the full layer will be analyzed, even if they are outside the current map extent.
The parameters for this tool are listed in the following table:
Parameter | Explanation |
---|---|
Choose imagery layer(s) to sample | A single image or a list of images whose values will be sampled based on the input location data. To sample all slices from a multidimensional imagery layer, it must be the only input raster. |
Choose location layer | Data identifying positions you want to sample. The input location data can be a raster, or a point, polyline, or polygon feature class. |
Specify Unique ID field (Optional) | A field containing a different value for every location or feature in the input location raster or feature class. |
Specify acquisition information of location data (Optional) | Specify the time, depth, or other acquisition data associated with the location cells or features. For each dimension, there are three options of specifying the acquisition information associated with location cells or features:
This parameter is only available when the Choose imagery layer(s) to sample parameter is a multidimensional raster. |
Specify buffer distance field or value (Optional) | The specified distance around the location data features. The buffer distance is specified in the linear units of the location feature's spatial reference. If the feature uses a geographic reference, the unit will be degrees. Statistics will be calculated within this buffer area. This parameter is only available when the Choose imagery layer(s) to sample is a multidimensional raster. |
Choose statistics type (Optional) | The type of statistic to be calculated.
This parameter is only available when the Choose imagery layer(s) to sample parameter is a multidimensional raster, and the Choose location layer parameters are polylines or polygons, or Specify buffer distance field or value (Optional) is specified. |
Percentile value (Optional) | This value can range from 0 to 100. The default is 90. This parameter is only available when the Choose statistics Type parameter is set to Percentile. |
Specify resampling technique (Optional) | Resampling algorithm used when sampling a raster.
|
Specify output layout (Optional) | Specifies whether sampled values appear in rows or columns in the output table.
This parameter is only available when the Choose imagery layer(s) to sample parameter is a multidimensional raster and contains one variable and one dimension, and each slice is a single-band raster. |
Specify output type (Optional) | Specifies whether to generate a point feature class with sampled values in its table, or only a table with sampled values.
|
Result layer name | The name of the layer that will be created in My Content and added to the map. The default name is based on the tool name and the input layer name. If the layer already exists, you will be prompted to provide another name. You can specify the name of a folder in My Content where the result will be saved using the Save result in drop-down box. |
Tip:
Click Show Credits before you run the analysis to check how many credits will be consumed.
Environments
Analysis environment settings are additional parameters that affect a tool's results. You can access the tool's analysis environment settings by clicking the settings button at the top of the tool pane.
This tool honors the following Analysis Environments:
- Extent—Specifies the area to be used for analysis.
- Mask—Specifies a mask layer, where only the cells that fall within the mask area will be used for analysis.
Similar tools and raster functions
Use the Sample tool to create a table or point feature class with data values at defined locations extracted from a raster or set of rasters. Other tools may be useful in solving similar problems.
Map Viewer Classic analysis tools and raster functions
Use the Summarize Raster Within tool or the Zonal Statistics raster function to summarize rasters within boundaries and create an image service output.
ArcGIS Pro analysis tools and raster functions
The Sample, Zonal Statistics and Zonal Statistics as Table geoprocessing tools are available in the Image Analyst and Spatial Analyst toolboxes.
The Summarize Raster Within and Zonal Statistics As Table tools are available in the Raster Analysis toolbox.
Zonal Statistics is also available as a raster function.
ArcGIS Enterprise developers resources
If you are working in ArcGIS REST API, use the Sample, Summarize Raster Within or Zonal Statistics As Table tasks.
If you are working in ArcGIS API for Python, use sample , summarize_raster_within or zonal_statistics_as_table from the arcgis.raster.analytics module, or use zonal_statistics from the arcgis.raster.functions.gbl module.