2

As it is seen in the picture, I have the attributes table which shows the random extracted routes from Istanbul highway map and points on it. Points are uniformly distributed through 2000 random extracted routes, once in 20 meters. Additionally, I added timestamp to each point, representing the imaginary cars' movement. For example, the car is in 0th meter of the route at 20:00:00, in 20th meter at 20:00:01 and so on. If the angle difference between 2 points is so much (100 or more), it means the car had turn on the route, which should make the car go slower. That's why I need to increase the time it takes to move between those 2 points. Question: how can I apply that condition to update the timestamp field when there is so much difference between 2 following angles?

P.S. I use QGIS 3.22.2, and the layer is in GeoPackage format.

P.S. It is not seen in the table, but between some 2 points, there is a reasonable angle change, it's just by chance that the angle values in the screenshot are same. enter image description here

Edit: I added the screenshot to show a sample route with turn. Between the points right before and after the turn, the angle difference is more than 100. There, for example, I need to apply delay to respective timestamp values.

enter image description here

1 Answer 1

1

Measure the distance between each point and the following point. For straight sections, the distance is 20. Where the line is curved, the distance is smaller. Depending on this distance, you can update the respective features.

To create a new attribute field for the distance, use this expression:

make_line (
    $geometry,
    geometry(get_feature_by_id(@layer, $id+1))
)

To calculate the angle diference between a point and the following one, based on the field angle, use this expression:

angle-
attribute (get_feature_by_id (@layer, $id+1),'angle')

For a more sophisticated way to identify curved sections of a road, see here.

Calculated difference to the next angle: white points have a change of 0, the darker the points are, the larger the difference is: enter image description here

3
  • Thank you so much for answering! But rather than identifying the turn, I need to find the solution to update the timestamps of the points :(. I created the attributes table by using graphical modeler and joined 2 layers (random extracted routes and points on them). So, I don't physically have the points, but only their distance and angle values. I may sound like a fool when I try to express myself, since I am so new in GIS. Sorry in advance :) Commented Jan 16, 2022 at 21:48
  • You don't have physically the points? In your question, you wrote: "I added timestamp to each point". Here, you write about two layers, one of them "points on them"? So do have a point layer or not? And what exactly is the problem, what do you want to do? I'm a bit confused....
    – Babel
    Commented Jan 16, 2022 at 21:52
  • Well, I had the points and routes, then I joined them by their osm_id field values. Afterwards, I only have the distance and angle values of the points (the first screenshot). Therefore, there is no points layers, but a single layer, including also angle and distance fields of previously existing points layer That's why, based on the angle values of features, I need to update the timestamps. That is the problem :( Commented Jan 16, 2022 at 21:56

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.