/[maps]/bin/nmea2kml.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /bin/nmea2kml.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 14 - (show annotations)
Mon Dec 3 14:25:40 2007 UTC (11 years, 11 months ago) by dpavlin
File MIME type: text/plain
File size: 830 byte(s)
- refactored NMEA parsing into own package from web interface
- script which converts NMEA dump to KML for GoogleMaps
1 #!/usr/bin/perl
2
3 # Convert GPS NMEA dump into Google's kml file
4
5 use strict;
6 use warnings;
7
8 use lib '../';
9 use NMEA;
10
11 my $path = shift @ARGV || die "usage: $0 nmea_dump.gps\n";
12
13 open(my $fh, '<', $path) || die "can't open $path: $!";
14
15 print qq{<?xml version="1.0" encoding="UTF-8"?>
16 <kml xmlns="http://earth.google.com/kml/2.2">
17 <Document>
18 <name>$path</name>
19 <Folder>
20 <name>NMEA trace</name>
21 };
22
23
24 my $point = 0;
25
26 while(<$fh>) {
27 my $hash = NMEA->line( $_ ) || next;
28
29 $point++;
30
31 print qq{
32 <Placemark>
33 <name>$point</name>
34 <description>
35 }, join(' ', map { ucfirst($_) . ':' . $hash->{$_} } ( qw/time lat lon speed course date var var_ew/ ) ), qq{
36 </description>
37 <Point>
38 <coordinates>}, $hash->{lon}, ',', $hash->{lat}, qq{,0</coordinates>
39 </Point>
40 </Placemark>
41 };
42 }
43
44 print qq{
45 </Folder>
46 </Document>
47 </kml>
48 };

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26