2

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°)

sketch displaying the point shift I'm trying to achieve

5
  • 1
    Yeah, first step would be adding slope and direction as attributes (add raster value to points), then you can go on.
    – Erik
    Commented May 3, 2022 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
    – Honeybear
    Commented May 3, 2022 at 8:48
  • @BERA no, I'd rather use continous values.
    – Honeybear
    Commented May 3, 2022 at 8:48
  • Can you add a screenshot showing the attribute table
    – Bera
    Commented May 3, 2022 at 8:55
  • 1
    And provide a logic which the shift should follow? Also: Should the actual geometry be moved, or does a changed symbology suffice?
    – Erik
    Commented May 3, 2022 at 9:00

1 Answer 1

3

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:

enter image description here

1
  • 1
    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.
    – Honeybear
    Commented May 5, 2022 at 14:45

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.