Geo::Distance 0.11
Sponsored Links
Geo::Distance 0.11 Ranking & Summary
File size:
0.010 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
834
Date added:
2007-07-24
Publisher:
Aran Clary Deltac
Geo::Distance 0.11 description
Geo::Distance is a Perl module that can calculate distances and closest locations.
SYNOPSIS
use Geo::Distance;
my $geo = new Geo::Distance;
$geo->formula(hsin);
$geo->reg_unit( toad_hop, 200120 );
$geo->reg_unit( frog_hop => 6 => toad_hop );
my $distance = $geo->distance( unit_type, $lon1,$lat1 => $lon2,$lat2 );
my $locations = $geo->closest(
dbh => $dbh,
table => $table,
lon => $lon,
lat => $lat,
unit => $unit_type,
distance => $dist_in_unit
);
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. Currently there is support for finding the closest locations within a specified distance, to find the closest number of points to a specified point, and to do basic point-to-point distance calculations.
METHODS
new
my $geo = new Geo::Distance;
my $geo = new Geo::Distance( no_units=>1 );
Returns a blessed Geo::Distance object. The new constructor accepts one optional argument.
no_units - Whether or not to load the default units. Defaults to 0 (false).
kilometer, kilometre, meter, metre, centimeter, centimetre, millimeter,
millimetre, yard, foot, inch, light second, mile, nautical mile,
poppy seed, barleycorn, rod, pole, perch, chain, furlong, league,
fathom
formula
if($geo->formula eq hsin){ ... }
$geo->formula(cos);
Allows you to retrieve and set the formula that is currently being used to calculate distances. The availabel formulas are hsin, polar, cos, and mt. hsin is the default and mt/cos are depreciated in favor of hsin. polar should be used when calculating coordinates near the poles.
reg_unit
$geo->reg_unit( $radius, $key );
$geo->reg_unit( $key1 => $key2 );
$geo->reg_unit( $count1, $key1 => $key2 );
$geo->reg_unit( $key1 => $count2, $key2 );
$geo->reg_unit( $count1, $key1 => $count2, $key2 );
This method is used to create custom unit types. There are several ways of calling it, depending on if you are defining the unit from scratch, or if you are basing it off of an existing unit (such as saying 12 inches = 1 foot ). When defining a unit from scratch you pass the name and rho (radius of the earth in that unit) value.
So, if you wanted to do your calculations in human adult steps you would have to have an average human adult walk from the crust of the earth to the core (ignore the fact that this is impossible). So, assuming we did this and we came up with 43,200 steps, youd do something like the following.
# Define adult step unit.
$geo->reg_unit( 43200, adult step );
# This can be read as "It takes 43,200 adult_steps to walk the radius of the earth".
Now, if you also wanted to do distances in baby steps you might think "well, now I gotta get a baby to walk to the center of the earth". But, you dont have to! If you do some research youll find (no research was actually conducted) that there are, on average, 4.7 baby steps in each adult step.
# Define baby step unit.
$geo->reg_unit( 4.7, baby step => adult step );
# This can be read as "4.7 baby steps is the same as one adult step".
And if we were doing this in reverse and already had the baby step unit but not the adult step, you would still use the exact same syntax as above.
distance
my $distance = $geo->distance( unit_type, $lon1,$lat1 => $lon2,$lat2 );
Calculates the distance between two lon/lat points.
closest
my $locations = $geo->closest(
dbh => $dbh,
table => $table,
lon => $lon,
lat => $lat,
unit => $unit_type,
distance => $dist_in_unit
);
This method finds the closest locations within a certain distance and returns an array reference with a hash for each location matched.
The closest method requires the following arguments:
dbh - a DBI database handle
table - a table within dbh that contains the locations to search
lon - the longitude of the center point
lat - the latitude of the center point
unit - the unit of measurement to use, such as "meter"
distance - the distance, in units, from the center point to find locations
The following arguments are optional:
lon_field - the name of the field in the table that contains the longitude, defaults to "lon"
lat_field - the name of the field in the table that contains the latitude, defaults to "lat"
fields - an array reference of extra field names that you would like returned with each location
where - additional rules for the where clause of the sql
bind - an array reference of bind variables to go with the placeholders in where
sort - whether to sort the locations by their distance, making the closest location the first returned
count - return at most these number of locations (implies sort => 1)
This method uses some very simplistic calculations to SQL select out of the dbh. This means that the SQL should work fine on almost any database (only tested on MySQL and SQLite so far) and this also means that it is fast. Once this sub set of locations has been retrieved then more precise calculations are made to narrow down the result set. Remember, though, that the farther out your distance is, and the more locations in the table, the slower your searches will be.
SYNOPSIS
use Geo::Distance;
my $geo = new Geo::Distance;
$geo->formula(hsin);
$geo->reg_unit( toad_hop, 200120 );
$geo->reg_unit( frog_hop => 6 => toad_hop );
my $distance = $geo->distance( unit_type, $lon1,$lat1 => $lon2,$lat2 );
my $locations = $geo->closest(
dbh => $dbh,
table => $table,
lon => $lon,
lat => $lat,
unit => $unit_type,
distance => $dist_in_unit
);
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. Currently there is support for finding the closest locations within a specified distance, to find the closest number of points to a specified point, and to do basic point-to-point distance calculations.
METHODS
new
my $geo = new Geo::Distance;
my $geo = new Geo::Distance( no_units=>1 );
Returns a blessed Geo::Distance object. The new constructor accepts one optional argument.
no_units - Whether or not to load the default units. Defaults to 0 (false).
kilometer, kilometre, meter, metre, centimeter, centimetre, millimeter,
millimetre, yard, foot, inch, light second, mile, nautical mile,
poppy seed, barleycorn, rod, pole, perch, chain, furlong, league,
fathom
formula
if($geo->formula eq hsin){ ... }
$geo->formula(cos);
Allows you to retrieve and set the formula that is currently being used to calculate distances. The availabel formulas are hsin, polar, cos, and mt. hsin is the default and mt/cos are depreciated in favor of hsin. polar should be used when calculating coordinates near the poles.
reg_unit
$geo->reg_unit( $radius, $key );
$geo->reg_unit( $key1 => $key2 );
$geo->reg_unit( $count1, $key1 => $key2 );
$geo->reg_unit( $key1 => $count2, $key2 );
$geo->reg_unit( $count1, $key1 => $count2, $key2 );
This method is used to create custom unit types. There are several ways of calling it, depending on if you are defining the unit from scratch, or if you are basing it off of an existing unit (such as saying 12 inches = 1 foot ). When defining a unit from scratch you pass the name and rho (radius of the earth in that unit) value.
So, if you wanted to do your calculations in human adult steps you would have to have an average human adult walk from the crust of the earth to the core (ignore the fact that this is impossible). So, assuming we did this and we came up with 43,200 steps, youd do something like the following.
# Define adult step unit.
$geo->reg_unit( 43200, adult step );
# This can be read as "It takes 43,200 adult_steps to walk the radius of the earth".
Now, if you also wanted to do distances in baby steps you might think "well, now I gotta get a baby to walk to the center of the earth". But, you dont have to! If you do some research youll find (no research was actually conducted) that there are, on average, 4.7 baby steps in each adult step.
# Define baby step unit.
$geo->reg_unit( 4.7, baby step => adult step );
# This can be read as "4.7 baby steps is the same as one adult step".
And if we were doing this in reverse and already had the baby step unit but not the adult step, you would still use the exact same syntax as above.
distance
my $distance = $geo->distance( unit_type, $lon1,$lat1 => $lon2,$lat2 );
Calculates the distance between two lon/lat points.
closest
my $locations = $geo->closest(
dbh => $dbh,
table => $table,
lon => $lon,
lat => $lat,
unit => $unit_type,
distance => $dist_in_unit
);
This method finds the closest locations within a certain distance and returns an array reference with a hash for each location matched.
The closest method requires the following arguments:
dbh - a DBI database handle
table - a table within dbh that contains the locations to search
lon - the longitude of the center point
lat - the latitude of the center point
unit - the unit of measurement to use, such as "meter"
distance - the distance, in units, from the center point to find locations
The following arguments are optional:
lon_field - the name of the field in the table that contains the longitude, defaults to "lon"
lat_field - the name of the field in the table that contains the latitude, defaults to "lat"
fields - an array reference of extra field names that you would like returned with each location
where - additional rules for the where clause of the sql
bind - an array reference of bind variables to go with the placeholders in where
sort - whether to sort the locations by their distance, making the closest location the first returned
count - return at most these number of locations (implies sort => 1)
This method uses some very simplistic calculations to SQL select out of the dbh. This means that the SQL should work fine on almost any database (only tested on MySQL and SQLite so far) and this also means that it is fast. Once this sub set of locations has been retrieved then more precise calculations are made to narrow down the result set. Remember, though, that the farther out your distance is, and the more locations in the table, the slower your searches will be.
Geo::Distance 0.11 Screenshot
Geo::Distance 0.11 Keywords
Distance 0.11
calculate distances
Perl module
unit
Geo-
distance
locations
closest
reg
Geo::Distance
GeoDistance
Geo::Distance 0.11
Libraries
Programming
Bookmark Geo::Distance 0.11
Geo::Distance 0.11 Copyright
WareSeeker periodically updates pricing and software information of Geo::Distance 0.11 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Geo::Distance 0.11 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
calculate distances between us cities
calculate distances between cities
locations north fork bank
distance learning programs
closest star to the sun
calculate distances between towns in britain
calculate distances in europe
mars closest to earth
western union locations
long distance relationships
distance learning courses
closest post office
locations photography
calculate distances between countries
distance formula
closest star to earth
locations magazine
united
Version History
Related Software
GIS::Distance::Polar can do Polar coordinate flat-earth distance calculations. Free Download
Geo::Spline is a Perl module to calculate geographic locations between GPS fixes. Free Download
GIS::Distance::Vincenty Perl module contains Thaddeus Vincenty distance calculations. Free Download
Data::ICal is a Perl module that generates iCalendar (RFC 2445) calendar files. Free Download
GEO project is a C++ geometric template class library. Free Download
Geo::Coordinates::VandH is a Perl module that can convert and manipulate telco V and H coordinates. Free Download
Geo::Inverse is a Perl module to calculate geographic distance from a lat & lon pair. Free Download
Tasks project is a simple to do list application that uses libecal, part of Embedded Evolution Data Server. Free Download
Latest Software
Popular Software
Favourite Software