Gpx length of steps

Hi,

I am currently working on a project where I need to compute routes between two coordinates and then have to create a profile describing that route. This includes an elevation profile, distance, profile, and speed profile.

ORS is really helpful for this task. I use the API to download a gpx file with my desired route adn extrtact the data from it (speed as distance/duration).

As I understand it every step has more than two coordinates. One desribing the starting point of the step and one the final point of the step. These are then sublimented by more points/coordinates inbetween that further describe the “shape” of the route.
The duration and distance given with each point in a step is always the same, pretaining to the complete step as a whole?
For now I just used the first and final point of each step to calculate an average gradient and speed that stay constant for the whole step. Because I cannot pin point the distance between the middle points or the time between them. Meaning I cannot calculate speeds or gradients for them. Just as a whole for the complete step.

Some steps, however span a distance of multiple kilometers which leads to inaccurate data that does not reflect the real road.

Is there a possibility to adjust the maximum length of each step? Or a different method to get finer data?

Hey,

I’m not sure whether gpx is the best file format for these types of calculation, but if that works for you, that should be fine :slight_smile:

What gpx gives you is a bunch of <rtept> (route-points).
The distance and duration reported in each route point corresponds to the step (also reported) that the point belongs to.

Each step is one instruction (e.g. “Turn left onto main street”) and the road that follows after that.
The next step then begins when the next navigational maneuver is necessary, i.e. when you have to do something different than “follow the road I’m currently on”.

The route itself is then visualized by drawing straight lines between these points - and these will already be small enough such that the geometry of the road is accurately represented.

Thus, if you need distances between the points, you can just calculate them with any geo-library capable of calculating straigth distances between points.
If you need more points than those given, you can just interpolate linearly between them yourself.
Any information about gradients is also just a linear interpolation between the points.

Best regards