Extract Values to Points (Spatial Analyst)

Available with Spatial Analyst license.

Summary

Extracts the cell values of a raster based on a set of point features and records the values in the attribute table of an output feature class.

Usage

  • All fields from the input point feature class will be carried over to the output point feature class.

  • A new field named RASTERVALU is added to the output to store the extracted values. If a field with this name already exists in the attribute table of the input features, the tool will fail to execute.

  • The input raster will not be resampled honoring the analysis environment. Instead, the cell values are extracted from the input raster in its original resolution and spatial reference by projecting the input locations to the raster's spatial reference from which values are extracted.

    However, the analysis environment is applied to the input locations.

  • Locations that extract values from NoData cells in the input raster will be given a <null> value in the output table. For shapefiles, because null fields are not supported, NoData cells are instead represented in the table with a value of -9999.

  • The shapefile format has a limitation on the maximum length of a field name of 10 characters. As a result, any fields that are appended to the attribute table of an output shapefile will have their names truncated and made unique by default. This may make it difficult to distinguish between the fields, particularly if the names are long or very similar. In this case, it is suggested to output to a file geodatabase instead.

  • The tool will fail to execute with multipoint features. To perform analysis with multipoint features, convert them to single point features before using them in the extraction tool. See processing multipoint data for more information.

  • When a multiband raster is specified as the Input Raster (in_raster in Python), only the first band will be used.

    To process a different band, specify the band to use.

    To extract values from multiple rasters or a multiband raster dataset, use the Extract Multi Values To Points tool.

  • The interpolation option determines how the values will be obtained from the raster. The default option is to extract the exact cell value at the input locations. To extract interpolated value using a bilinear method, check the Interpolate values at the point locations (interpolate_values in Python) option.

  • To add all the attributes from the input raster table, check the Append all the input raster attributes to the output point features option (ALL for the add_attributes parameter in Python). The attributes will be carried over as-is to the output point features, keeping the same values. Note that, depending on the nature of the property being recorded, some of the attribute values may need to be recalculated.

  • If the Output Coordinate System environment hasn’t been explicitly specified, the spatial reference of the output feature class is derived from the input point features. However, if the output is written to a feature dataset, with or without Output Coordinate System environment specified, the output spatial reference will be same as the feature dataset.

  • If a feature is specified in the Mask environment, it will be converted to a raster internally, using the cell size and cell alignment from the input raster.

  • See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.

Syntax

ExtractValuesToPoints(in_point_features, in_raster, out_point_features, {interpolate_values}, {add_attributes})
ParameterExplanationData Type
in_point_features

The input point features defining the locations from which you want to extract the raster cell values.

Feature Layer
in_raster

The raster dataset whose values will be extracted.

It can be an integer or floating-point type raster.

Raster Layer
out_point_features

The output point feature dataset containing the extracted raster values.

Feature Class
interpolate_values
(Optional)

Specifies whether interpolation will be used.

  • NONENo interpolation will be applied; the value of the cell center will be used. This is the default.
  • INTERPOLATEThe value of the cell will be calculated from the adjacent cells with valid values using bilinear interpolation. NoData values will be ignored in the interpolation unless all adjacent cells are NoData.
Boolean
add_attributes
(Optional)

Determines if the raster attributes are written to the output point feature dataset.

  • VALUE_ONLYOnly the value of the input raster is added to the point attributes. This is the default.
  • ALLAll the fields from the input raster (except Count) will be added to the point attributes.
Boolean

Code sample

ExtractValuesToPoints example 1 (Python window)

This example extracts the cell values from a raster based on locations defined by a point shapefile, and creates an output point feature class of those values.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
ExtractValuesToPoints("rec_sites.shp", "elevation",
                      "C:/sapyexamples/output/outValPnts","INTERPOLATE",
                      "VALUE_ONLY")
ExtractValuesToPoints example 2 (stand-alone script)

This example extracts the cell values from a raster based on locations defined by a point shapefile, and creates an output point shapefile of those values.

# Name: ExtractValuesToPoints_Ex_02.py
# Description: Extracts the cells of a raster based on a set of points.
# Requirements: Spatial Analyst Extension

# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "C:/sapyexamples/data"

# Set local variables
inPointFeatures = "rec_sites.shp"
inRaster = "elevation"
outPointFeatures = "C:/sapyexamples/output/extractvaluespts.shp"

# Execute ExtractValuesToPoints
ExtractValuesToPoints(inPointFeatures, inRaster, outPointFeatures,
                      "INTERPOLATE", "VALUE_ONLY")

Licensing information

  • Basic: Requires Spatial Analyst
  • Standard: Requires Spatial Analyst
  • Advanced: Requires Spatial Analyst

Related topics