Map, distance and eta

Hi,

Id like to know if there is simple option for finding estimated distance and ETA without needing the actual navigation / directions ?
For both A to B and also from start point through various points on route to the destination.
As i say the actual navigation / directions aren't needed but obviously the route needs to be calculated to give distance and time so there may be no difference in the method of finding the result.
Using polygon

Thanks
Steve

Simple? Take your choice:

  • Calculate straight line distance between two coordinates rather than a Navigation route

  • use
    directions
    and post duration and distance to a Label

  • Use Google Map api and Directions
    or
    distance-matrix

Steve, straight line distance would be way off travel distance as this is Scotland.
Distance matrix looks good but only appears to handle an origin and destination no intermediate points though I guess I could build total accumulative time / distance one stop at a time.
Not had a chance to look at the other options yet but will and update when I get a chance.

Cheers

I was playing around with the distance matrix API.
Is there a simpler way to get the mileage result than this ?

Seems very long winded

Show your responseContent

{
"destination_addresses" :
[
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, UK"
],
"origin_addresses" :
[
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, UK"
],
"rows" :
[
{
"elements" :
[
{
"distance" :
{
"text" : "13.8 mi",
"value" : 22210
},
"duration" :
{
"text" : "27 mins",
"value" : 1628
},
"status" : "OK"
}
]
}
],
"status" : "OK"

this help ?
image

Any better for you?

{"destination_addresses" : [ "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, UK"], "origin_addresses" : ["xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, UK"], "rows" : [ { "elements" : [ { "distance" : { "text" : "13.8 mi", "value" : 22210 }, "duration" : { "text" : "27 mins", "value" : 1628 }, "status" : "OK" } ] } ], "status" : "OK"}

Very interesting !!!!

Google distance matrix works well for A to B distances but not for from start point through various waypoints on route to a destination.
Most of the other options I found online are for calculating matrix, which is far more complex than my requirement .
I simply want to calculate the estimated mileage mileage from A through 7 or 8 waypoints back to A, I don't even need the directions just the mileage
Can I use the Navigation component for a total route mileage ?
I imagine I would I need to use multiple distances between two points ie: Calculate A to B, B to C, C to D and D to A then add the distances to get the total distance for the route ?

.

Yes. Simple way is to use 8 Navigate components, 8 Design time Markers, 7 Clocks and some experimentation.

This example uses 5 waypoints. It doesn't go back to the origin (but it could).

The Entire Route button uses the Clocks to ask for the route, captures time and duration (but doesn't total, but it could)

Of course this could be done without the Clocks; providing waypoints (Markers) and running Navigate the required number of times, capturing the individual distance and duration and storing them, then adding all the durations and also the durations for totals :wink:

To keep things simple as possible I opted for using Geoapify API

Geoapify API doesnt seem very accurate to me.
I see Navigate uses openrouteservice and that their API allows for routes with waypoints so have been exploring that option.

I have openrouteservice API working ok for me now and it seems pretty good took a little effort to understand why I couldnt get it to work for me to start with but its probably a much simpler option than using 8 or 10 navigate components and clocks.