I am working on a system that detects the lat/long of vehicles. I want to track other vehicle's position: left, top-left, right, top-right, bottom-right, bottom-left etc based on lat/long.

I have used following logic to detect the bearing and direction of a vehicle:



Using the above script, I am able to detect the direction and bearing of other vehicles but could not get their position: left, right etc.


Relative to another point, and assuming a north-oriented map:

If the longitude is less, it is to the left, if more, to the right.

If the latitude is greater, it's above it, if less, below it.

Based on the North-clockwise bearings in the first link, 0 is up, between 0 and 90 (exclusive) up-right, 90 right, > 90 - < 180 down-right, 180 down, > 180 - <270 down-left, 270 left, > 270 - <360 up-left.

Which all seems too simple, am I missing something in your question?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.