Is it possible by latitude and longitude to know if the direction?

Asked

Viewed 249 times

0

Guys, I’m sorry if you don’t mean the question !

It will be possible by the latitude coordinate, longitude know the direction of the example vehicle if it is to the north or south or east or west example with php or javascript !

  • North, south, east or west in relation to what? null island?

  • I meant by the example coordinate -4.3141, -69.5711 if you put this coordinate in Google Maps it will be in the Amazon river more precise know if it is going up the river or down the river

  • You want to know movement?

  • 2

    You need at least two points obtained at different times to know in which direction you are going.

  • hi @renan have the two coordinates yes I will receive every 5 minutes each coordinated

  • I have latitude and longitude every 5 minutes then the next one has point A and point B more between the points I receive every 5 minutes the most accurate coordinate to know if it is going to point A or going to point B

  • 1

    Cara is a valid doubt, but gives a better deal on geographical coordinates

Show 2 more comments

1 answer

5


What you want is a mix of GPS with inertial navigation. Some apps like Google Maps and Waze do this to know the direction a vehicle takes, especially on devices without a compass.

The technique is simple: get the device coordinates at two different points. The direction that the device follows is the vector that connects the two points and part of the first obtained.

The difficulty is that this vector must be obtained in three dimensions, with geodesic calculation. I leave it up to you to research the mathematics involved, as well as the mimation of the Apis to be used. Javascript can be used to obtain geolocation data in the browser. I don’t know if PHP has native API for this, but I think there are libraries to work with GPS.

And if you have a more specific question, please feel free to open a new question.

  • 2

    Pretty cool the answer.

Browser other questions tagged

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