Evenly spaced way points

Dear ORS community and team,

I am new to ORS. What I would like to achieve is getting a route with evenly spaced waypoints and elevation data, e.g. there should be a waypoint all say 100 meters.
Is that possible somehow?
What I got so far is a Dart Console Application that fetches 2D route data. This works perfect. I then fetch the elevation data. This also works great.
So thanks for this a lot.
But when computing distances between way points I observed differing distances.
This also makes sense to me. But is there a chance to get data as specified above?

Best regards from Aachen, Germany
Marcus

Hey,

what would you hope to gain from evenly spaced waypoints?
Given that you have a route, you can calculate evenly spaced waypoints yourself, I’d assume?

The ors doesn’t support this, since it wouldn’t make too much sense. Think about a route in a town with a lot of small, short streets. Having one waypoint every 100 meters would probably lead to having to guess at every junction.

Best regards

Hey jschnell,

thank you very much for your reply. I highly appreciate that.
At the end I need an elevation profile over the whole route as input to a control algorithm. The density of the profile should be quite high and equally distributed (best).
Let’s say, if I consider two points being 1km far from each other it is useless to know the elevation in both points to determine the slope. The route could be like a sin function which I cannot cover if I do not know enought supporting points in between.
I also thought about calculating the supporting points on my own but I don’t know how to assure that I am still on the route specified when computing random supporting points.
Hope the idea and the problem got somewhat clear.

Best regards,
Marcus

Hey,

so I understand it you’re not interested in the waypoints themselves, but in the elevation?
As stated, the ors doesn’t support this.
However, every point on a direct line between two adjacent way points of the returned route is on the route.
You wouldn’t have to compute random support points, but can compute any point on the route.

Hope that helps,
Best regards

Hey,

I am also interested in the way points. But in more points than provided through the service.
So as you said I want to compute supporting way points in between two way points given through the API, e.g. all hundred meters. I then need the elevation data of these intermediate supporting points as well to determine the slope between them.
If I compute such points all 100 or 200 meters, would I be able to query elevation data for these?

Best regards and thanks a lot again,
Marcus

Hey,

as discussed, you can calculate supporting way points by yourself. The ors doesn’t support querying elevation for specific points.
To get elevation information for these additional waypoints, I can think of two ways:
You could either use an external elevation service or query more routes with pairs of adjacent waypoints, yielding elevation for these two waypoints (which as start and endpoints will always include elevation).

Best regards

Hey,

tank you :slight_smile:
I still don’t understand how to compute intermediate points.
I understand graphs a bit. But do the edges not just represent a direct connection between two way points only?
If I consider two points A and B connected to each other in the graph, i.e. an edge exist between them, but the route follows a curvature from a geographical point ov view how can I then determine an intermediate point having longitude and latitude data?
That is what I cannot figure out actually.
If you could provide me with a hint or and example you have at hand I’d appreciate this a lot.

Best regards,
Marcus

Hey,

if the route follows a curve, intermediate waypoints will be given, connected by straight segments.
You can see this best if you query the geojson-endpoint for any route e.g. via the playground, save the resulting geojson, view it in any viewer (e.g. geojson.io) and change the type at the end of the file to MultiPoint, giving you not a line but the points that make up the line.

Any point between these points will also be on your route.

Best regards

Hey,

great. I didn’t know that the points are also geographically connected through straight lines. Then it should be easily possible to determine intermediate points.
One last question. Does the elevation service, if I provide him with a random point on line segment compute the elevation? Or is elevation data “only” known for the waypoints stored in the database?
I mean I will try this out now but would be good to have an answer to this from your side as well.

Best regards and thanks a lot you took that much time.
Marcus


It worked. I simply took some random points on a street from Google Earth. I took these as input for the elevation service and I got quite accurate data.

You could also pipe your determined 100m points into the elevation (line) service and then extract the elevation from there, but as the elevation of every point the route traverses is already known, and you have to calculate the distance anyway, you can easily just use the elevation value from the 2 surrounding routepoints and calculate the elevation with the same factor as the distance to the other points.

The resolution of the elevation data is 90x90m, so sinusodal variations in elevation don’t matter that much anyway,as routepoints are rarely 1km apart from each other.

If D and E are points of the route (not waypoints) and you calcualte your 100m point at H.
You check the distance factor for H between D and E and apply it to the elevation values from D and E.
And you have your elevation for the 100m mark.

Best regards

Hi amandus,

sorry for the late reply and thank you very much for your answer.
I do the computation on my own now.
That works pretty well.
Great service you offer :slight_smile:

Best regards,
Marcus

2 Likes