The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

GIS::Distance - Calculate geographic distances.

SYNOPSIS

  use GIS::Distance;
  my $calc = GIS::Distance->new();
  my $distance = $calc->distance( $lon1,$lat1 => $lon2,$lat2 );

DESCRIPTION

This perl library aims to provide as many tools to make it as simple as possible to calculate distances between geographic points, and anything that can be derived from that.

Please note that this is alpha software. This module will become the replacement for Geo::Distance. So, until this module is well tested and production worthy I would recommend using that.

METHODS

new

  my $calc = GIS::Distance->new();

Returns a blessed GIS::Distance::Haversine object by default. If you want to use a different formula, such as the GIS::Distance::Vincenty, then call new() on that class.

distance

  my $distance = $calc->distance( $lon1,$lat1 => $lon2,$lat2 );

Calculates the distance between two lon/lat points in decimal degree format. In return you will receive an Class::Measure::Length object.

FORMULAS

GID::Distance::Cosine

GID::Distance::GeoEllipsoid

GID::Distance::GreatCircle

GID::Distance::Haversine

GID::Distance::MathTrig

GID::Distance::Polar

GID::Distance::Vincenty

TODO

Create a GIS::Coord class that represents a geographic coordinate. Then modify this module to accept input as either lon/lat pairs, or as GIS::Coord objects.

Create an extension to DBIx::Class with the same goal as Geo::Distance's closest() method.

BUGS

The graphs produce by graph_deviations.pl script show that the GIS::Distance::GreatCircle formula is not performing well at all. In most cases it is either returning a distance of 0 or a distance of 20,000 km.

AUTHOR

Aran Clary Deltac <bluefeet@cpan.org>

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.