Page 1 of 1

Show WiGLE-data in Google Earth (WiGLE to KML)

Posted: Sun Mar 23, 2008 10:12 pm
by riddick
I started an experimental project to fetch and parse WiGLE-data into a KML using Google Earth's "Network Link"-feature.

Requirements:
-PHP5 with SQLite3 support (via PDO)
(code was tested with Server2go)

Download:
here (ca. 1 MiB)
ALL FILES ARE COPYRIGHTED BY ME!

Usage/Remarks:
Put everything on a server meeting the requirements. In Google Earth add a "Network Link" to the wigle.php. On the first use, you'll be asked for a username and password - enter your WiGLE-credentials there. (The project is prepared for multi-user-use.) The PHP will check whether the needed area is already in the SQLite-cache or it will request the data from wigle.net.

For now there's no expiration of cached data. So to force it to reload a specific area, you have to use an SQLite-db-tool (such as SQLite Spy) and manually delete the desired area from the wigleareas table (using a DELETE FROM-statement).

The file CachedWigle.file.class.php is NOT working. It was meant to store everything in separate files but then I decided that SQLite is a bit easier and better to implement.

If you change the class CachedWiGLE in wigle.php to just WiGLE, you'll deactivate caching and all requests will be made directly to the server. But note that the server will block you after some few requests.

The file MAC_OUI.bin contains a MAC-address to company-mapping. You can update it by putting the files iab.txt and oui.txt from the IEEE-homepage into the directory. They will get parsed automatically and the file MAC_OUI.bin will get updated.


Have phun!


Cheers,
-mARKUS

Posted: Mon Mar 24, 2008 9:33 am
by jvisser
G'Day,

Creating a KML file is something I have been trying to do for a while. I have had a play around with some of the kismet to kml scripts, but having one created using the network link feature I think would be great....

Only issue is when I just tryed loading up your pages and database it seems to fail... in google earth I get the error:

error at line 1, column 0:

File has missing or bad root element.

Im afraid I have little to no experience with this kinda feature in google earth, but have a bit with PHP and sql type applications.. and I cant see a problem on that side, all files and folders have write permissions, and it isnt throwing any warnings or errors.

I am running Ubuntu Gusty with a Apache/2.2.4 (Ubuntu) PHP/5.2.3-1ubuntu6.3 setup (sqlite3 installed with php modules).

If you need anything else let me know, it would be great if you could help me to get this to work.. or point me in the right direction.

Jake

Posted: Mon Mar 24, 2008 9:58 am
by riddick
Only issue is when I just tryed loading up your pages and database it seems to fail... in google earth I get the error:

error at line 1, column 0:

File has missing or bad root element.
This sounds as if there is no KML returned. If there's really no PHP error occurring, it may be because of missing auth data. Do you get a box asking for a username and password for "WiGLE2KML"?

You may also try opening the wigle.php in a browser window directly to see what the output looks like.

Append a bounding box with coordinates like the following:

http://someserver/somepath/wigle.php?BB ... 3.50,52.09

The order is: west, south, east, north border of viewing box. Negative values are Western/Southern hemisphere, positive values are Eastern/Northern hemisphere.

If you get the auth window there and after entering credentials you get something XML-like (see page source), it really is because of Google Earth not showing the auth window.

In that case, try setting the credentials manually in the file wigle.php. Delete the block:

Code: Select all

if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="' . $kml->name . '"'); header('HTTP/1.0 401 Unauthorized'); echo $kml->throwError('Please authenticate first!'); exit; }
and set the following two lines to your WiGLE-username and -password.


Cheers,
-mARKUS

Posted: Mon Mar 24, 2008 1:59 pm
by jvisser
G'Day again,

I feel like a bit of an idiot now... turns out there was a problem with the way i had my pecl_http module loading... so I was actually getting an error on the http_post_fields() command....

Its all fixed now and is working like a charm. I would be interested in seeing any further updates you make, and I was having a bit of a play to try and getting the info boxes to show some other information as well (like encryption mode) and other generic information.

Thanks for this great package.

Jake

Posted: Fri Apr 04, 2008 6:33 am
by evyncke
Very interesting work, just a couple of gotchas:
- LOG_FILE should not be in the current directory but rather /tmp/wigle.log (specially on Linux systems)
- database file wigle.db3 should be owned by www-data or apache or whatever userid apache runs on
- pecl install pecl_http, pecl install pdo, and on Linux PHP_PDO_SHARED=1 pecl install PDO_SQLITE are really your friends

Alas, nothing is displayed on my google earth (see my other post about the wigle API error message).

But, great work! Thanks

Posted: Tue Apr 22, 2008 7:47 am
by themacuser
Nice work.

I had something half-written to do this in Python already, but never quite finished it. Guess I should.

Posted: Fri May 30, 2008 2:39 pm
by mparker37
I tried this at http://www.wifi.freezoka.com/wigle.php? ... 3.50,52.08 but just get an empty file returned.

Any ideas?

I don't really understand php, so please excuse me if I'm being slow

Ta

Mick

Re: Show WiGLE-data in Google Earth (WiGLE to KML)

Posted: Thu Feb 02, 2012 11:15 pm
by Gingerpaul
I've tried to copy this project because the links are super old like this topic.

Anyways,

It all works if i pass a lat and long. I just cannot get Google Earth to send what I want.

If someone could explain the BBOX that'd be great or if you can upload the files again.