DESCRIPTION

This module finds the geometric median point of locations on the earth's surface. Also known as euclidean space this is the point where the sum of great circle distances to the locations is minimal. The point is more resistant to outliers than the mean center. The module will guess a point and refine it based on the (weighted) mean center until a good enough approximation is found.

FUNCTIONS

median_center(\%options)

Computes the median center of a list of points. Options are points, an array of arrays of latitude and longitude in decimal degrees and optionally a weight; tolerance, a number in meters, if the iterative algorithm improves its approximation by at most this value, the function will return; max_iterations, the function will return after this many attempts to refine the approximation. Returns the latitude and longitude in decimal degrees.

haversine_distance_dec($lat1, $lon1, $lat2, $long2)

Computes the distance between the two points using the Haversine formula in meters. Latitude and longitude are specified in decimal degrees.

haversine_distance_rad($lat1, $lon1, $lat2, $long2)

Computes the distance between the two points using the Haversine formula in meters. Latitude and longitude are specified in radians.

EXPORT

The function median_center is exported by default, the other functions on request.