提取属于 RasterLayer(栅格)特定区域的点
Extracting points that belong to a certain area of a RasterLayer (raster)
如题。
我有一个 "classified" RasterLayer
对象,它有(除了 NA
s)两个固定值,0
和 1
。是一种逻辑形象。
我还有一个点的数据框及其坐标,形式为 SpatialPointsDataFrame
。
如何提取属于特定区域(0
或 1
)的点?一直在寻找 raster-package
帮助,但找不到解决方案。
您可以使用 raster
包中的 extract
:
"Extract values from a Raster* object at the locations of other
spatial data (that is, perform a spatial query). You can use
coordinates (points), lines, polygons or an Extent (rectangle) object.
You can also use cell numbers to extract values."
values <- extract(x="YourRasterLayer", y="YourSpatialPointsDataFrame")
更多信息类型:
?raster::extract
或访问此 page.
如题。
我有一个 "classified" RasterLayer
对象,它有(除了 NA
s)两个固定值,0
和 1
。是一种逻辑形象。
我还有一个点的数据框及其坐标,形式为 SpatialPointsDataFrame
。
如何提取属于特定区域(0
或 1
)的点?一直在寻找 raster-package
帮助,但找不到解决方案。
您可以使用 raster
包中的 extract
:
"Extract values from a Raster* object at the locations of other spatial data (that is, perform a spatial query). You can use coordinates (points), lines, polygons or an Extent (rectangle) object. You can also use cell numbers to extract values."
values <- extract(x="YourRasterLayer", y="YourSpatialPointsDataFrame")
更多信息类型:
?raster::extract
或访问此 page.