I track my location with Google and my phone, because I lack sufficient paranoia. To the right is my June 30.
I swear that I didn't leave the Greater Lafayette area. I certainly didn't teleport to the southern suburbs of Indianapolis.
This happens to me all the time, and it has bugged me a lot. But, normally I've just looked and griped, rather than trying to work it out.
Today, however, I'm watching a compiler or two, so I have some time I can use to work this out.
The protocol is KML, and this is what it looks like:
I swear that I didn't leave the Greater Lafayette area. I certainly didn't teleport to the southern suburbs of Indianapolis.
This happens to me all the time, and it has bugged me a lot. But, normally I've just looked and griped, rather than trying to work it out.
Today, however, I'm watching a compiler or two, so I have some time I can use to work this out.
The protocol is KML, and this is what it looks like:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"> | |
<Document> | |
<name>Location history from 06/30/2015 to 07/01/2015</name> | |
<open>1</open> | |
<description/> | |
<StyleMap id="multiTrack"> | |
<Pair> | |
<key>normal</key> | |
<styleUrl>#multiTrack_n</styleUrl> | |
</Pair> | |
<Pair> | |
<key>highlight</key> | |
<styleUrl>#multiTrack_h</styleUrl> | |
</Pair> | |
</StyleMap> | |
<Style id="multiTrack_n"> | |
<IconStyle> | |
<Icon> | |
<href>http://earth.google.com/images/kml-icons/track-directional/track-0.png</href> | |
</Icon> | |
</IconStyle> | |
<LineStyle> | |
<color>99ffac59</color> | |
<width>6</width> | |
</LineStyle> | |
</Style> | |
<Style id="multiTrack_h"> | |
<IconStyle> | |
<scale>1.2</scale> | |
<Icon> | |
<href>http://earth.google.com/images/kml-icons/track-directional/track-0.png</href> | |
</Icon> | |
</IconStyle> | |
<LineStyle> | |
<color>99ffac59</color> | |
<width>8</width> | |
</LineStyle> | |
</Style> | |
<Placemark> | |
<name>Latitude User</name> | |
<description>Location history for Latitude User from 06/30/2015 to 07/01/2015</description> | |
<styleUrl>#multiTrack</styleUrl> | |
<gx:Track> | |
<altitudeMode>clampToGround</altitudeMode> | |
<when>2015-06-30T13:11:50.556-07:00</when> | |
<gx:coord>-86.9113936 40.4224106 0</gx:coord> | |
<when>2015-06-30T13:13:05.103-07:00</when> | |
<gx:coord>-86.1233968 39.6461108 0</gx:coord> | |
</gx:Track> | |
</Placemark> | |
</Document> | |
</kml> |
That isn't all day's results, merely the point in time I jumped 67 miles to the southeast. I was going to try to use a KML-specific Perl module, but found that the ones I could find were more about generating it than parsing it, and it's XML, so I figured what the heck.
I had previous code to work out the distance between two points, so it was an easy case of parsing to find the jump:
I had previous code to work out the distance between two points, so it was an easy case of parsing to find the jump:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use feature qw{ say } ; | |
use strict ; | |
use warnings ; | |
use utf8 ; | |
use DateTime ; | |
use Math::Trig qw(deg2rad pi great_circle_distance asin acos) ; | |
# Lafayette: 40°25′2″N 86°52′43″W | |
# Greenwood: 39°36′41″N 86°07′05″W | |
my $file = '/home/jacoby/Dropbox/history-06-29-2015.kml' ; | |
my @when ; | |
my @latlong ; | |
if ( open my $fh, '<', $file ) { | |
while (<$fh>) { | |
if (m{<when>}) { | |
my ($time) = m{<when>(.+)</when>} ; | |
push @when, $time ; | |
} | |
if (m{<gx:coord>}) { | |
my ($place) = m{<gx:coord>(.+)</gx:coord>} ; | |
push @latlong, $place ; | |
} | |
} | |
close $fh ; | |
} | |
my $last_time ; | |
my $last_place ; | |
for my $i ( map { $_ - 1 } 1 .. scalar @when ) { | |
my $time = $when[$i] ; | |
my $place = $latlong[$i] ; | |
if ($last_time) { | |
my $tt = ( split m{\.}, $time )[0] ; | |
my ( $long, $lat ) = split m{\s+}, $place ; | |
my $d_time = diff_time( $time, $last_time ) ; | |
my $d_place = diff_loc( $place, $last_place ) ; | |
my $flag = ( $d_place > 1 ) ? '*' : ' ' ; | |
say join "\t", $flag, $tt, $lat, $long, $d_time, | |
( sprintf '%.5f', $d_place | |
if $d_place > 30 ; | |
} | |
$last_time = $time ; | |
$last_place = $place ; | |
} | |
sub diff_loc { | |
my ( $place1, $place2 ) = @_ ; | |
my ( $lon1, $lat1 ) = split m{\s+}, $place1 ; | |
my ( $lon2, $lat2 ) = split m{\s+}, $place2 ; | |
return haversine( $lat1, $lon1, $lat2, $lon2 ) ; | |
} | |
sub haversine { | |
my ( $lat1, $lon1, $lat2, $lon2 ) = @_ ; | |
my $r = 3956 ; | |
my $dlon = deg2rad($lon1) - deg2rad($lon2) ; | |
my $dlat = deg2rad($lat1) - deg2rad($lat2) ; | |
my $a | |
= sin( $dlat / 2 )**2 | |
+ cos( deg2rad($lat1) ) * cos( deg2rad($lat2) ) * sin( $dlon / 2 ) | |
**2 ; | |
my $c = 2 * ( asin( sqrt($a) ) ) ; | |
my $dist = $r * $c ; | |
return $dist ; | |
} | |
sub diff_time { | |
my ( $time1, $time2 ) = @_ ; | |
my $t1 = parsetime($time1) ; | |
my $t2 = parsetime($time2) ; | |
my $diff = abs $t2->epoch - $t1->epoch ; | |
return $diff ; | |
} | |
sub parsetime { | |
my $string = shift ; | |
$string =~ s{\..+$}{} ; | |
my @time = split m{\D+}, $string ; | |
my $dt = DateTime->new( | |
year => $time[0], | |
month => $time[1], | |
day => $time[2], | |
hour => $time[3], | |
minute => $time[4], | |
second => $time[5], | |
time_zone => 'America/Indiana/Indianapolis' | |
) ; | |
return $dt ; | |
} |
Breaking it down, at 2015-06-30T13:13:05.103-07:00 I go 67 miles to Greenwood, and at 2015-06-30T13:53:31.467-07:00 I pop back.
Let me bring up an other map.
I didn't have any mapping software going, and I was using wifi, so this data is location via wifi not GPS. I know, though, that the group that runs my servers has a weekly "coffee break" on Tuesdays, that I met with my admin there, and I walked around toward his office before goign back to mine. His building is off S. Grant St., and I walked next to Hawkins Hall, in front of Pao Hall, near the Forestry Building and down to my office in Whistler.
So, question is, how does location over WiFi work? I recall hearing that routers and access points report location, but I'm not sure of the protocols involved. I can imagine two possible scenarios that cause this.
First is that one of Purdue's routers is misreporting location, either in Forestry or Pao. This is possible; I have another issue that I haven't worked through yet where I leap instantly to the EE building, and it seems that's entirely based on location within my building.
The second scenario, one I'm taking more and more seriously, is that there's a replicated MAC address or something between the apartments across from Pao Hall. I say "or something" because MAC addresses should be unique. The thing that makes me suspect this is that it points me to a residential neighborhood south of Indy, and I could see that mistake happening with two residential routers or two experimental electronics projects.
I'm curious about how to test this, because I do want to know it has something to do with Purdue's networking gear before I complain. I'm also curious about how these things actually work. I could very much see me walking around, looking at Google Maps and tripping over things, then trying to dump my ARP tables or something.
Let me bring up an other map.
I didn't have any mapping software going, and I was using wifi, so this data is location via wifi not GPS. I know, though, that the group that runs my servers has a weekly "coffee break" on Tuesdays, that I met with my admin there, and I walked around toward his office before goign back to mine. His building is off S. Grant St., and I walked next to Hawkins Hall, in front of Pao Hall, near the Forestry Building and down to my office in Whistler.
So, question is, how does location over WiFi work? I recall hearing that routers and access points report location, but I'm not sure of the protocols involved. I can imagine two possible scenarios that cause this.
First is that one of Purdue's routers is misreporting location, either in Forestry or Pao. This is possible; I have another issue that I haven't worked through yet where I leap instantly to the EE building, and it seems that's entirely based on location within my building.
The second scenario, one I'm taking more and more seriously, is that there's a replicated MAC address or something between the apartments across from Pao Hall. I say "or something" because MAC addresses should be unique. The thing that makes me suspect this is that it points me to a residential neighborhood south of Indy, and I could see that mistake happening with two residential routers or two experimental electronics projects.
I'm curious about how to test this, because I do want to know it has something to do with Purdue's networking gear before I complain. I'm also curious about how these things actually work. I could very much see me walking around, looking at Google Maps and tripping over things, then trying to dump my ARP tables or something.
No comments:
Post a Comment