| GIS-Distance documentation | Contained in the GIS-Distance distribution. |
GIS::Distance::Formula::GeoEllipsoid - Geo::Ellipsoid distance calculations.
my $gis = GIS::Distance->new();
$gis->formula( 'GeoEllipsoid', { ellipsoid => 'WGS84' } );
This module is a wrapper around Geo::Ellipsoid for GIS::Distance.
Normally this module is not used directly. Instead GIS::Distance is used which in turn interfaces with the various formula classes.
See the documentation for Geo::Ellipsoid.
$calc->ellipsoid( 'AIRY' );
Set and retrieve the ellipsoid object. If a string is passed then it will be coerced in to an object.
This method is called by GIS::Distance's distance() method.
GIS::Distanc
Aran Clary Deltac <bluefeet@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| GIS-Distance documentation | Contained in the GIS-Distance distribution. |
package GIS::Distance::Formula::GeoEllipsoid;
use Any::Moose; use namespace::autoclean; with 'GIS::Distance::Formula'; use Any::Moose '::Util::TypeConstraints'; use Class::Measure::Length qw( length ); use Geo::Ellipsoid;
subtype 'GeoEllipsoid' => as 'Object' => where { $_->isa('Geo::Ellipsoid') }; coerce 'GeoEllipsoid' => from 'Str' => via { my $type = $_; return Geo::Ellipsoid->new( units => 'degrees', ( $type ? (ellipsoid=>$type) : () ), ); }; has 'ellipsoid' => ( is => 'rw', isa => 'GeoEllipsoid', default => '', coerce => 1, );
sub distance { my $self = shift; return length( $self->ellipsoid->range( @_ ), 'm' ); } __PACKAGE__->meta->make_immutable; 1; __END__