3

I have an issue. I have a set of points (n=~2000) and I would like to extract the pixel values from multiple rasters (a single-raster solution is also ok) for location of that point as well as that of all eight neighbours.

  • Do you have the Spatial Analyst Extension? Also does the raster store integer values or do you need every floating point value in a float? – jbchurchill Oct 3 '14 at 17:52
  • One other question. Is it possible for more than one point to occur in a given 8-cell neighborhood? – jbchurchill Oct 3 '14 at 18:05
  • If using r, have a look at ?extract from the raster package – Paul Regular Oct 3 '14 at 18:33
  • jbchurchill . i have spatial analyst extension and my rasters have floating point values. Points into consideration are randomly distributed and many lie near to each other hence even in the 8 cell neigbourhood. hence each point should be considered as unique when extracting – dhyeyey Oct 4 '14 at 14:00
  • 1
    @dhyey For each of your points you'll have nine values. Did you want to calculate something with the nine values (e.g. the average) and output it to the attribute table of the points? Or was there something else that you wanted to do with the data? – WhiteboxDev Oct 4 '14 at 15:21
2

Here is how I would consider doing this if I absolutely had to have every neighborhood value (which is what it sounds like). First create 2 fields for the point geometry (one for x and one for y) and calculate the geometry for the x field and y field. I would be sure my point file was in a projected coordinate system like UTM Meters or State Plane Feet. Better if the units match units represented in the cell size of the raster. Then I'd create 16 more fields ULX, ULY, UCX, UCY, URX, URY, CLX, CLY, CRX, CRY, LLX, LLY, LCX, LCY, LRX, LRY.

Diagram

I'm going to describe my example using 30 meter cells. So next I'd use the x and y fields for the point to create new x and y values for ULX, LCX, and LLX calculate each of those fields with the field calculator X - 30. for UC and LC it is just the same value as X, and for UR, CR, and LR it is x + 30. Then to calculate the Y values CL and CR are equal to Y. The top row UL, UC, and UR are Y + 30 and LL, LC, LR are Y - 30. So now all the fields are populated. I'd create 8 new point feature classes or shapefiles using the 16 x and y fields using "Add XY Data". Keeping an ID value the same in all of them (FID), you can then run "Extract Values to Points" or "Sample" from the Spatial Analyst Toolbox on the original file (for the central cell) and all the other point feature classes. These results could then be brought individually into a spreadsheet and put back together so that each original ID has a value for UL, UC, UR, CL, Original Point, CR, LL, LC, and LR.

You could script the adding of the fields and calculating of the values if you needed to do this again for different sets of points.

For a 5 x 5 neighborhood, you would need to be more creative in naming your fields and there would be 25 total feature classes / shapefiles, but it could be done this way too.

  • 1
    This seems to be a nice working solution to my problem. thank you @jbchurchill. – dhyeyey Oct 6 '14 at 15:45
  • Happy to help! If you didn't need every value and just needed an average or a max or something, @Hornbydd 's method sounds like it would work pretty well too though single points might still need to be processed one by one. – jbchurchill Oct 6 '14 at 16:09
4

You appear to be looking at a suite of software options. A way of doing it in ArcMap model builder using off the shelf tools could be:

This method assumes that your points are not so close that their masks overlap. If overlap is going to be an issue then you could use a feature iterator to feed out single points and process them one at a time, this would generate a raster per point.

  • +1 Nice use of Expand – Aaron Oct 4 '14 at 19:51
  • @Hornbydd . my points are randomly spread, with many of them very close to each other. I will look up to your suggested solution – dhyeyey Oct 5 '14 at 18:36
0

You want to get the values of a pixel and its 8 surrounding pixels from points. It can be done in ArcGIS10.2 easily now.

  • (1) Using the Focal Statistics tool to create an output raster where the value for each output cell is a function (eg. MEAN, MAXIMUM, MINIMUM, SUM...) of the values of all the original input cells that are in a specified neighborhood (in this case: Rectangle of 3*3 cells) around that location.
  • (2) Using the Extract Values To Points tool to extract the output raster values to your point features.

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.