I have a raster file and a SpatialLinesDataFrame in R. I need to find the distance between each pixel (at the center) and the nearest point in the line file. I believe this is the functional equivalent of the "near" function in ArcGIS. Is there a package or function that does this in R?
The raster is of a landscape with the year of deforestation as the cell value. The lines file is a series of roads- 34 total. I'm trying to determine the probability of deforestation around the roads using the distance of a point from the road as a variable.
The raster structure is:
# class : RasterLayer # dimensions : 9003, 7906, 71177718 (nrow, ncol, ncell) # resolution : 0.00025, 0.00025 (x, y) # extent : -52.7825, -50.806, -1.125, 1.12575 (xmin, xmax, ymin, ymax) # coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 # data source : U:\Jacy\Research\TS_line_analysis\GIS_Project\NE_Hansen # names : NE_Hansen # values : 0, 14 (min, max)