Extract by Circle (Spatial Analyst)
Summary
Extracts the cells of a raster based on a circle.
Usage
-
The center of the cell is used to determine whether a cell is inside or outside a circle. If the center is within the arc of the circle, the cell is considered fully inside even if portions of the cell fall outside the circle.
-
Cell locations that are not selected are assigned a value of NoData.
-
When a multiband raster is specified as input, a new multiband raster will be created as output. Each individual band in the input multiband raster will be analyzed accordingly.
The default output format is an ESRI grid stack. Note that the name of an ESRI grid stack cannot start with a number, use spaces, or be more than 9 characters in length.
-
If the input is a layer created from a multiband raster with more than three bands, the extraction operation will only consider the bands that were loaded (symbolized) by the layer. As a result, the output multiband raster can only have three bands, corresponding to those used in the display of the input layer.
-
If the input raster is integer, the output raster will be integer. If the input is floating point, the output will be floating point.
Syntax
Parameter | Explanation | Data Type |
in_raster |
The input raster from which cells will be extracted. | Raster Layer |
center_point |
The Point class dictates the center coordinate (x,y) of the circle defining the area to be extracted. The form of the class is:
The coordinates are specified in the same map units as the input raster. | Point |
radius |
Radius of the circle defining the area to be extracted. The radius is specified in map units and is in the same units as the input raster. | Double |
extraction_area (Optional) |
Identifies whether to extract cells inside or outside the input circle.
| String |
Return Value
Name | Explanation | Data Type |
out_raster |
The output raster containing the cell values extracted from the input raster. | Raster |
Code Sample
This example extracts cells within a 500-meter radius around a point location.
import arcpy from arcpy import env from arcpy.sa import * env.workspace = "C:/sapyexamples/data" outExtCircle = ExtractByCircle("elevation", arcpy.Point(482838.823, 222128.982), 500, "INSIDE") outExtCircle.save("c:/sapyexamples/output/extcircle")
This example extracts cells within a 1,000-meter radius around a point location.
# Name: ExtractByCircle_Ex_02.py # Description: Extracts the cells of a raster based on a circle. # Requirements: Spatial Analyst Extension # Author: ESRI # Import system modules import arcpy from arcpy import env from arcpy.sa import * # Set environment settings env.workspace = "C:/sapyexamples/data" # Set local variables inRaster = ("elevation") centerPoint = arcpy.Point(482838.823, 222128.982) circRadius = 1000 extractType = "INSIDE" # Check out the ArcGIS Spatial Analyst extension license arcpy.CheckOutExtension("Spatial") # Execute ExtractByCircle outExtCircle = ExtractByCircle(inRaster, centerPoint, circRadius, extractType) # Save the output outExtCircle.save("c:/sapyexamples/output/extcircle02")