[GIS] Selecting vector features that overlay raster in ArcPy

arcpyraster

I have two datasets: point feature class and raster (stored in file geodatabase).

The spatial extent of the raster is smaller than the point dataset.

Is there a way I could select (or create new, temporary layer/feature class) only the points that fall into the extent of the raster?

Basically I'd like to have an output similar to Clip or Intersect tools, but they don't seem to accept rasters as inputs.

Is there readily available arcpy tool(s) that could be used to achieve that? Or would it require some custom solution?

Best Answer

The attached script which utilizes Raster Domain will work for you.

# Import arcpy module
import arcpy
from arcpy import env

# Check out any necessary licenses
arcpy.CheckOutExtension("3D")

# Set Workspace
env.workspace = r"C:\data"

# Create a polygon around the raster boundary
arcpy.RasterDomain_3d("inRaster.tif", "outShp", "POLYGON")

# Intersect points with boundary polygon
arcpy.Intersect_analysis(["outShp.shp", "points.shp"], "intersect_output", "ALL", "", "INPUT")

For a direct, non ESRI approach, check out Geospatial Modelling Environment's (GME) isectpntrst (Intersect Points With Raster).

Related Question