GPS
Mike Schwartz
mschw at athenet.net
Tue Jan 27 17:04:58 PST 2015
> I need an algorithm of sorts. I have the coordinates of a container
stored in a
> record and they are in two fields. For example, one field will contain
> 35.64321 as the North coordinate and 101.45675 as the West coordinate. (I
> strip off the negative sign) If a person calls at a different coordinate
I
> need way of finding the closest container. Can someone please help with
> the calculation?
>
> Ted B
What sort of distances are involved? If a customer in New York has to
decide whether a container in India or one in South Africa is closer, then
you will have to calculate a great-circle route using the filePro trig
functions. Here are some formulas along with explanations of great circle
routes:
http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates
If the containers are in a much smaller area, say, within the New
England states, then you can triangulate their distance using the
Pythagorean Theorem with a little (probably acceptable) error. (A square +
B square = C square) A couple of quick calculations and you are done,
without needing any trig. This method might be acceptable over longer
distances, depending on how much error you are willing to accept.
The more difficult thing would be to try to calculate the distance
between the two containers by following roads. You would have to create a
data file to download into some sort of mapping software, like PC*miler, or
some delivery route software.
Mike Schwartz
More information about the Filepro-list
mailing list