Skip To Content

How Sample works

Available with Spatial Analyst license.

If the input locations for the Sample tool are specified as a point feature dataset, the point coordinates may not be the same as the cell centers of the cells specified in the input raster. To determine the values at the exact locations of the selected points, a resampling technique must be adopted. For discrete data types, the default Nearest resampling algorithm will be satisfactory. However, for continuous data types, it is more appropriate to perform another resampling technique. For instance, for elevation data, applying bilinear interpolation or cubic convolution will provide more accurate results. The bilinear option will determine the cell values based on a weighted distance of the four nearest input cell centers. The cubic option will compute the cell value based on the weighted distance of the nearest 16 cells.

The Process as multidimensional parameter determines how the input rasters are sampled. If this parameter is checked, the input rasters will be sampled along all of their dimensions; otherwise, only the current slice of a multidimensional raster will be sampled. When the process as multidimensional parameter is checked, the sampled values appear in separate rows of the output table (row-wise output). When the parameter is unchecked, sampled values appear as separate columns in the output table (column-wise). Row-wise output can be helpful when using the output table to create charts or graphs.

Sample output for two-dimensional rasters

For each sample location, information on the location number (the raster value or point feature ID), location in map space (x,y coordinates), and cell values from each of the input rasters is written to the table. The table has the following general structure:

    locationID-1 x-coord1 y-coord1 cellvalue1 cellvalue2 cellvalue3 ....
    locationID-2 x-coord2 y-coord2 cellvalue1 cellvalue2 cellvalue3 ....

An example of an FGDB table output from the Sample tool follows:

Example output table from Sample for a two-dimensional input raster

Sample output for multidimensional rasters

For each sample location, information on the location number (the raster value, point feature ID, or value of the field specified in the Unique ID parameter) and cell values from each of the input rasters is written to the table. A new row is added to the table for each unique combination of dimension values. For example, if a dataset has 10 depths for four time periods and there are two sample locations, the resulting table will contain 80 rows. The table has the following general structure:

    locationID-1 cellvalue dimensionAvalue1 dimensionBvalue1 ....
    locationID-1 cellvalue dimensionAvalue1 dimensionBvalue2 ....
    locationID-1 cellvalue dimensionAvalue2 dimensionBvalue1 ....
    locationID-1 cellvalue dimensionAvalue2 dimensionBvalue2 ....
    locationID-2 cellvalue dimensionAvalue1 dimensionBvalue1 ....
    locationID-2 cellvalue dimensionAvalue1 dimensionBvalue2 ....
    locationID-2 cellvalue dimensionAvalue2 dimensionBvalue1 ....
    locationID-2 cellvalue dimensionAvalue2 dimensionBvalue2 ....

An example of an FGDB table output from the Sample tool follows:

Example output table from Sample for a multidimensional input raster

Related topics