1

I have a raster(.tif) and point(.shp) layer. To calculate the average value of points located in each pixels:
(1) For each image pixel that include multiple points, the average value of all points located in the pixel were calculated.
(2) For each image pixel that include single point, the point value was chose directly.
How can I calculate it in R ?

  • Do you know how to read a raster or a shapefile in? Or do we have to start from zero? Please give some code to show where you are so far. – Spacedman Dec 22 '18 at 17:37
  • I do this in ArcGIS before, but it is time consuming and limited to 2GB data in ArcGIS. I get basic grammar and simple spatial analysis about R. So, I have no idea to calculate it so far. – changkx Dec 22 '18 at 17:49
-1

Two ways in ArcGIS to solve this problem:
1. Create a fishnet
1) Using ‘Create Fishnet’ tool to create a fishnet capture the raster pixel;
2) Using ‘Identify’ tool to identify the points located in each fishnet grid;
3) Using ‘Dissolve’ tool to calculate the average value of points located in each fishnet grid, set ‘Dissolve_Field’ parameter with ‘fishnet grid id’;
4) Using ‘Extract multi-values to points’ tool to extract the raster value.
2. Convert point to raster
1) Using ‘Point to raster’ tool convert point to raster, set ‘Cell assignment type’ parameter with ‘Mean’;
2) Using ‘Extract multi-values to points’ tool to extract the raster value.

  • This is not a solution to the question, which specifically asks for an approach in R. – JepsonNomad Mar 27 at 3:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.