5

I have an arcpy script creating thousands of points in a feature layer, based on a river network. At creation time, I'd like to use the value from a (large) elevation raster corresponding to the new point's location.

It needs to be at creation time, because I want to subtract the value from the previous value, and that information will be difficult to get afterwards.

I've tried using sa.ExtractValueToPoints, but it's very slow and it's a lot of extra overhead to create a point feature with my x,y data, run the function, and then extract the value from the newly created feature. There are a few tens of thousands of points...

Is there some way of getting directly at the raster data (while retaining the spatial information) that I don't know about?

Edit: I managed to work around it as explained below in my comments. I'll explore the NumPy option, as I think this is something I might run into again.

5
  • What version of ArcGIS are you using? Do you have a 3D Analyst or Spatial Analyst License? If you have access to 3D analyst you should have a look at the Add Z Information tool...
    – dru87
    Commented Feb 24, 2016 at 14:54
  • Also, have you looked at this post? I don't think yours is a proper duplicate but it might still help you. gis.stackexchange.com/questions/28298/…
    – dru87
    Commented Feb 24, 2016 at 15:01
  • 1
    You could use NumPy to access the raster (arcpy.RasterToNumPyArray), you'd just have to calculate the appropriate row and column based on the coordinates you are interested in. Commented Feb 24, 2016 at 15:25
  • Thanks for the comments. I've decided to try just using sa.ExtractValuesToPoiints on all of the points, and use some programming to figure out their relation to each other afterwards. For more clarification, I'm trying to calculate the vertical drop between points on rivers.
    – carderne
    Commented Feb 24, 2016 at 15:29
  • If I don't get that to work, I'll look into these recommendations. I do have 3D Analyst and Spatial Analyst, so that could definitely be a possibility.
    – carderne
    Commented Feb 24, 2016 at 15:30

2 Answers 2

3

Your comment "trying to calculate the vertical drop between points on rivers" made me think a bit more about the problem. Since you probably have two or more raster datasets with elevation data (before and after), why don't you use the raster calculator to calculate the difference between your elevation rasters? This would equal the drop in each raster cell.

Then you'd only have to run the Extract Value to Point tool once. You could even clip your raster to the buffered river network beforehand in order to reduce processing time.

1
  • 1
    Just to follow up. It's only one raster, I'm merely calculating the elevation difference between two points on the same raster. But I managed to make it work by doing Extract Value to Point on all the points and doing the difference calculation afterwards.
    – carderne
    Commented Feb 25, 2016 at 8:40
0

To extract raster value by coordinates: https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/get-cell-value.htm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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