I am a beginner in raster object, and I have a particular problem.
Suppose that I have a raster which is focus on Mexico.
Besides, I have created a SpatialPoint Object of coordinates that are accurate of different locations that stand for let's say houses.
I would like to extract the houses within the positive values of the raster. How should I do ?
class : RasterLayer
dimensions : 72, 122, 8784 (nrow, ncol, ncell)
resolution : 0.25, 0.25 (x, y)
extent : -117.125, -86.625, 14.625, 32.625 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
data source : in memory
names : layer
values : 54.00137, 126.3991 (min, max)
Formal class 'SpatialPoints' [package "sp"] with 3 slots
..@ coords : num [1:459382, 1:2] -103.4 -98.2 -114.8 -110.9 -110 ...
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr [1:459382] "1026" "1027" "1028" "1029" ...
.. .. ..$ : chr [1:2] "Longitude" "Latitude"
..@ bbox : num [1:2, 1:2] -117.1 14.7 -86.7 32.7
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr [1:2] "Longitude" "Latitude"
.. .. ..$ : chr [1:2] "min" "max"
..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot
.. .. ..@ projargs: chr "+init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"