Measure distance on map (between user and a location using a distance that follows roads)

Can help me how measure distance between my location and other location and when the car near from me like 300 meter send notification To be ready
Note:not direct distance i need way distance

The straight line distance between two locations is easy using a Math algorithm or the Map component.

To get the navigate distance (following roads for instance), you need to use either

  • the MIT Navigate component to tell you the distance

gotdirections2

  • or the Google Directions api to extract the distance

Use a Clock to constantly poll the distance using RequestDirections or using the Directions API.

Once you get the distance compare it to 300 m, when the distance is less than 300m, send your notification. :wink:

This method requires constant requests to be made using WIFI or data and in my opinion is not real practical; but go ahead an experiment and let us know what happens.

What have you tried?

This link contains advice that might be helpful for completing your Project Calculer la distance entre son domicile et un point donnée dans une textbox - #2 by SteveJG

2 Likes

I am trying get my current location as first point and the other point is a (driver location from firebase Database)
Then when distance less 300m push notification

Maybe something like this ..

1 Like

I will try this thank you so much

This calculate road distance ?or line distance ?