1GIS::Distance::Formula(U3spemr)Contributed Perl DocumentGaItSi:o:nDistance::Formula(3pm)
2
3
4
6 GIS::Distance::Formula - Formula base class.
7
9 This is the parent class for all GIS::Distance formula classes such as
10 those listed at "FORMULAS" in GIS::Distance.
11
12 To author your own formula class:
13
14 package My::Formula;
15
16 use parent 'GIS::Distance::Formula';
17
18 sub _distance {
19 my ($lat1, $lon1, $lat2, $lon2) = @_;
20
21 # ...
22
23 return $kilometers;
24 }
25
26 1;
27
28 Then use it:
29
30 my $gis = GIS::Distance->new('My::Formula');
31 my $km = $gis->distance( @coords );
32
33 The global $GIS::Distance::Formula::SELF is available when your
34 "_distance()" subroutine is called if, and only if, the entry point was
35 "distance" in GIS::Distance and NOT "distance_metal" in GIS::Distance
36 or otherwise.
37
38 Much of the interface described in GIS::Distance is actually
39 implemented by this module.
40
42 See "SUPPORT" in GIS::Distance.
43
45 See "AUTHORS" in GIS::Distance.
46
48 See "LICENSE" in GIS::Distance.
49
50
51
52perl v5.34.0 2021-07-22 GIS::Distance::Formula(3pm)