Thursday, 23 June 2011

☆ Fun with iPhone Tracking Logs and Chrome WebGL Experiment

I was a little intrigued by the then Google Chrome WebGL experiments demoed at Google I/O this past week so I grabbed some of the source code to play with it a little.



After poking around I thought it might be fun to map out some of that infamous iPhone Location Tracking Data in the WebGL globe so I grabbed my consolidated.db file, exported the CellLocation table and ran it through this quick PHP script:




$data = explode("\n",file_get_contents("CellLocation.data"));

$magnitudes = array();

// Group like towers
$c = count($data);
for ($i = 0 ; $i < $c ; $i++) {
$ll = $data[$i];
list($lat,$lng) = explode('|',$ll);
$key = round($lat,2) . ',' . round($lng,2);

if (array_key_exists($key, $magnitudes)) {
$magnitudes[$key]++;
} else {
$magnitudes[$key] = 1;
}
}

$json = '';
while (list($ll,$count) = each($magnitudes)) {
$json .= str_replace('|',',', $ll);
$json .= ',';
$json .= $count / 100;
$json .= ',';
$json .= 11;
$json .= ',';
}

echo '['.trim($json,',').']';


Dropping the output of the script in the place of the search results json file presented me with this:



Visual of the iPhone tracking data on a globe.
iPhone Tracking Data on the Google Chrome Experiment WebGL Globe



You can play with the live WebGL version here if you want. Now I just have to learn a little more WebGL to make the map zoom in and out.



UPDATE: Looking at the globe.js source, apparently you can zoom if you have a mouse with a wheel though it’s very pixelated.



Generated by BlogIt

BlogIt - Auto Blogging Software for YOU!

BlogIt - autoblogging software for YOU

BlogIt - autoblogging software for YOU

No comments:

Post a Comment