0

I would like to create a raster in which the cell values contain the angle between that cell and a single vector point. It would be as though a line were projected between the cell and the point, and the angle would be that between this line and a line-oriented to 0 degrees (straight north). I can’t find a function in ArcGIS or QGIS that might easily accomplish this.

It seems that what I’m asking for is the azimuth of raster cells relative to a single point. This old question was the same but wasn’t definitively answered: Creating direction raster in QGIS

Taras
  • 32,823
  • 4
  • 66
  • 137
Matt
  • 67
  • 4
  • I'm curious. Why? – Pointdump Mar 11 '23 at 13:31
  • It’s part of a visibility analysis for an elliptical structure. With that info I can solve the width of the structure from any angle. – Matt Mar 11 '23 at 14:01
  • @Matt what workflow did you come up with? I'm trying to do something similar to calculate widths between structures. – JNN May 23 '23 at 15:31

3 Answers3

3

You could rasterize your point then use the Euclidean Direction Raster tool. You will need a Spatial Analyst license for this tool in ArcGIS. I also see that this tool is slated for deprecation and set to be replaced with this.

GBG
  • 9,737
  • 1
  • 15
  • 44
  • This is the solution I used, however, it creates a raster with directions from the raster pixels to the point, rather than vice versa. I used the raster calculator to reorient the directions: Con(rastername >180, rastername - 180, rastername + 180) – Matt Mar 12 '23 at 12:10
3

Using QGIS:

  1. Menu Processing > Toolbox > Raster pixels to points to convert the raster to a point layer (one point for each pixel center)

  2. Create a new attribute azimuth with Field Calculator and this expression:

    degrees(
        azimuth( 
            overlay_nearest(
                'point',  -- replace by name of your point layer
                $geometry
            )[0],
            $geometry
        )
    )
    
  3. Menu Raster > Conversion > Rasterize (vector to raster) and set the attribute azimuth from step 2 as input for Field to use for a burn-in value parameter.

Result - azimuth from red point:

enter image description here

Babel
  • 71,072
  • 14
  • 78
  • 208
2

In R you can do

library(terra)
r <- rast(ncol=36,nrow=18, crs="+proj=merc")

point <- cbind(0, 0) r <- rasterize(point, r, 1)

b <- direction(r, degrees=TRUE) plot(b)

enter image description here

Robert Hijmans
  • 10,683
  • 25
  • 35