Skip to content

DistanceTo(...)

Alex-Kent edited this page Apr 3, 2019 · 5 revisions

$meters = $index->DistanceTo( \%point_2 );
$meters = $index->DistanceTo( \@point_2 );
Returns the distance in meters between the specified point and the one set earlier with DistanceFrom(…).

The haversine function is used to compute the distance. As this assumes a spherical body the distances returned may show errors. Using the default options, these errors are up to 0.056% (north - south) or 1.12% (east - west).
Such errors typically start becoming significant at distances over 20 km.


%point_2 or @point_2
The point to measure distances to

This can be either a hash containing at a minimum a lat and a lon value (both in degrees) or an array giving the point. See the Points section for details.

Clone this wiki locally