Google maps measure mileage between two points per hour

Asked

Viewed 496 times

0

Next galera: has how in google maps measure speed (mileage) between two points by the time of each point example:

  • Point A (Lat and Long + time type 10:00 hs)

  • Point B (Lat and Long + time type 11:00 hs)

Then the speed would be approximately 45 kilometers per hour between the 2 points example !

I saw on this site below that I need exactly this for a project someone can help in something there ?

follow the link where I saw this : https://www.sunearthtools.com/pt/tools/distance.php

Follow the code of how I get data point 1 and point 2 and each point has the time now I need to know the speed

<?php
$xml = simplexml_load_file('https://api.findmespot.com/spot-main-web/consumer/rest-api/2.0/public/feed/0gUKvaesqck4s3oqr65sqUimR9gUjnSQd/message.xml');
$i = 0;
foreach($xml->feedMessageResponse->messages->message as $message) {
    $i++;
}?>

<?php $data_um = $xml->feedMessageResponse->messages->message[0]->dateTime; ?>
<?php $data_dois = $xml->feedMessageResponse->messages->message[1]->dateTime; ?>

Hora Ponto um:<?php echo  date('H:i:s', strtotime($data_um));?><br>
Lat Ponto um:<?php echo $latitude = $xml->feedMessageResponse->messages->message[0]->latitude;?><br>
long Ponto um:<?php echo $longitude = $xml->feedMessageResponse->messages->message[0]->longitude;?><br>


<hr> </hr>



Hora Ponto dois:<?php echo  date('H:i:s', strtotime($data_dois));?><br>
Lat Ponto dois:<?php echo $latitude = $xml->feedMessageResponse->messages->message[1]->latitude;?><br>
long Ponto dois:<?php echo $longitude = $xml->feedMessageResponse->messages->message[1]->longitude;?><br>
  • 1

    The speed in km/h shall be given by distancia em km/horas, and the distance in the Cartesian plane is sqrt((x2-x1)² + (y2-y1)²). Already have the code that will fetch the two points ? If yes ask the question.

  • Hello buddy could put me an example ?

  • You already have the code that picks up the two points you’re interested in as well as the hours ? If you can put that code in the question I will answer, otherwise the question becomes too broad

  • Already buddy Isac tai the code of how I caught the data would be this ?

  • According to the link you posted, the average speed is calculated according to the time you indicate you can use to travel a certain distance. Already in your example from understand that you want to calculate the average speed using the time zone difference between points A and B.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.