I am trying to create a route without knowing the endpoint. I know my current location, speed and direction. I want to be able to define an endpoint on the same road I am travelling on either a given distance or at the end of the road if it is shorter than the distance.
How could I do that?
that’s a very specific use case. I don’t see a way to do this with our API.
You could just generate an endpoint in that direction, but the route would still use different streets to get as close to the endpoint as possible.
Or do you mean “up” or “down” the road with direction?
Maybe elaborate a bit on the use case.
I want to be able to be able to get information about places in front of the car relating to the speed and direction. I do not know where the car is going, just current location, speed and direction. And I want to be able to calculate which side of the road the places are located. I can do much of this with your current api. But when I calculate a forward position, it sometimes will be in locations where there are not roads and I get an error from the routes api. So I want to be able to snap my forward location to the road I am travelling on at some calculated distance, or at the end of the current road if it is shorter.
Does that help?
i see. You can’t snap the point you are looking for to the road you are currently travelling on, but you can increase the snapping radius to the road-network by using the
radiuses parameter of the directions api.
But i guess that in most cases it will not snap to the the road you are travelling on, but some other.
Apart from that that’s not really solvable with our API