Wget raster values for overlaying vector data
#or to return only the e.g. mean values of e.g. overlaying polygons (identical to zonal statistics but works with vector data as zone features)
#set the values of a raster with the desired extent and resolution ("baseraster") #to NA: values(baseraster)=NA #...Then update this emty raster with the shape information: rasterize(shapeLayer,baseraster)
If a table is to rasterize use the following code:
With Z is the value which the raster cells should have.
#distance from a point to all cells of a RasterLayer. values(rasterLayer)=NA distanceFromPoints(rasterLayer, SpatialPoint)
If the distance is to be calculated from a raster object, see euclidean_distance in the chapter 1-Raster Operations. This function might also be useful for vector or line features: convert them to a raster and then use this function.
zonal(rasterLayer, ZoneRaster, 'mean')