# Shift points based on attribute (e.g. slope and aspect, preferably with QGIS)

I'm trying to shift point coordinates "upwards" based on a slope/aspect raster that I have computed beforehand. Working preferably with QGIS, but other means (i.e. R/ArcGIS [Standard/Pro]) are also possible.

I've looked for transformations, but haven't figured out how I'd make it dependent on attributes in general (~ underlying raster cells, specifically slope/aspect in my case).

I.e. I have a point dataset with points "red" and "blue" (black circle in image) from which I'd like to generate a new point dataset (green circle in image) based on slope/aspect.

red:

• slope: 45° (steep => larger shift)
• aspect: 0° (facing north => moving south (180°))

blue:

• slope: 10° (shallow => minor shift)
• aspect: 90° facing east => moving west (270°)

• Yeah, first step would be adding slope and direction as attributes (`add raster value to points`), then you can go on.
– Erik
May 3 at 8:40
• @Erik thanks, getting the raster values as attributes is not the problem though. generating the new coordinates based on them I haven't figured out yet May 3 at 8:48
• @BERA no, I'd rather use continous values. May 3 at 8:48
• Can you add a screenshot showing the attribute table
– BERA
May 3 at 8:55
• And provide a logic which the shift should follow? Also: Should the actual geometry be moved, or does a changed symbology suffice?
– Erik
May 3 at 9:00

## 1 Answer

Use QGIS expressions with Geometry Generator (for visualization purpose only) or Geometry by Expression (for actual geometries) - see here for more details about both options.

Use this expression, replacing `slope` and `aspect` with the names of your attribute fields:

``````project(
\$geometry,
slope,
radians (180+aspect)
)
``````

Red points shifted to the blue destination, including a coeficient of 2000 on line 3 for the distance:

• This is perfect, I'd give +2 if I could for even providing a solution for visualization only. That allows to quickly experiment with the coefficient to scale the distance of the shift without generating actual geometries on each iteration! Thank you. May 5 at 14:45