Wednesday, April 20, 2011

Mapping the cell locations from an iphone db on google maps

IOs stores the GPS locations of towers it connects to in this file:


It's an sqlite3 file... So here is a script to pull the longtitude and lattitudes and turn them into a simple KML file.

#this is the KML heading
echo '<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="">

#pull the longitude and latitude from sqlite3
for i in $(sqlite3 consolidated.db 'select longitude,latitude from celllocation';)
do coordinate=$(echo $i | sed 's/|/,/g')

echo '<Placemark><name>'$coordinate'</name><Point><coordinates>'$coordinate',0</coordinates></Point></Placemark>'

echo '</Document></kml>'

I added this to my lighttpd.conf and restarted it.

  ".kml"       =>      "application/",

Then it's just a matter of passing the kml file to google maps..$yourserver/output.kml

I noticed a bunch of towers I never connected to  (far away places) so there are some problems with this.

No comments:

Post a Comment