GPS::Garmin - Perl interface to GPS equipment using the Garmin Protocol
use GPS::Garmin; $gps = new GPS::Garmin( 'Port' => '/dev/ttyS0', 'Baud' => 9600, );
To transfer current position, and direction symbols:
($latsign,$lat,$lonsign,$lon) = $gps->get_position;
To transfer current time:
($sec,$min,$hour,$mday,$mon,$year) = $gps->get_time;
To transfer trackpoints:
$gps->prepare_transfer("trk"); while($gps->records) { ($lat,$lon,$time) = $gps->grab; }
To transfer Waypoints:
$gps->prepare_transfer("wpt"); while($gps->records) { ($title,$lat,$lon,$desc) = $gps->grab; }
GPS::Garmin allow the connection and use of of a GPS receiver in perl scripts. Currently only the GRMN/GRMN protocol is implemented but NMEA is a work in progress.
This module currently works with Garmin GPS II+ equipments, but should work on most Garmin receivers that support the GRMN/GRMN protocol.
Make sure your GPS receiver is in host mode, GRMN/GRMN protocol. To start a connection in your script, just:
use GPS::Garmin; $gps = new GPS::Garmin ( 'Port' => '/dev/ttyS0', 'Baud' => 9600, ) or die "Unable to connect to receiver: $!";
Where Port is the port that your GPS is connected to, and Baud the speed of connection ( default is 9600 bps).
To know current coordinates:
($latsign,$lat,$lnsign,$lon) = $gps->get_position; $ltsign is "S" or "N" (South or North) $lat is current latitude in degrees.minutes. $lnsign is "W" or "E" (West or East) $lon is current longitude in degrees.minutes.
To transfer the track records:
$gps->prepare_transfer("trk");
while($gps->records) { ($lat,$lon,$time) = $gps->grab; }
$time is in unix epoch seconds
- Trackpoint transfer won't work in the following Garmin devices, since they don't support it:
GPS 50 GPS 55 GPS 150 GPS 150 XL GPS 165 GNC 250 GNC 250XL GNC 300 GNC 300XL
You can check you GPS capabilities by looking at the table in page 50 of the Garmin protocol specification at http://www.garmin.com/support/protocol.html
- You need to have Win32::SerialPort to have GPS::Garmin working in Windows.
Lacks documentation
Joao Pedro B Gonçalves , joaop@iscsp.utl.pt
Peter Bennett's GPS www and ftp directory:'
ftp://sundae.triumf.ca/pub/peter/index.html. http://vancouver-webpages.com/peter/idx_garmin.html
Official Garmin Communication Protocol Reference
http://www.garmin.com/support/protocol.html
2 POD Errors
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
Non-ASCII character seen before =encoding in 'Gonçalves'. Assuming CP1252
To install GPS::Serial, copy and paste the appropriate command in to your terminal.
cpanm
cpanm GPS::Serial
CPAN shell
perl -MCPAN -e shell install GPS::Serial
For more information on module installation, please visit the detailed CPAN module installation guide.