[ This chapter does not appear in the book. ]
I made things easy for myself in the last chapter by relying on a GPS receiver to generate latitude and longitude information. In this chapter, I throw away the GPS device (figuratively, of course), and determine my position and geographical address (my geolocation) without its help.
Although this seems a daunting task, I'm encouraged by the availability of geolocation in HTML5. Even when there's no GPS receiver attached to the computer, a tiny piece of JavaScript executed by the browser can return your latitude and longitude.
I want to emulate HTML5's geolocation API in Java without having to fire-up a browser. Also, I'm going to restrict my hardware to a netbook without a GPS receiver, RFID or Bluetooth; the machine's only connection to the wider world will be through WiFi. This leaves two starting points for finding my location: IP and MAC addresses.
The diagram at the top of this page shows the various ways I'll be using IP and MAC addresses in this chapter.
The IP and MAC addresses of my netbook aren't much use, because they're for a mobile device. Instead I have to reach out across the wireless network for the addresses of WiFi Access Points (APs). These APs are probably in fixed positions, and so likely to be listed in location databases.
The dotted lines and arrows in the diagram have Java program names next to them. For example, I'll describe two programs, GoogleMAC.java and SkyhookMAC.java, for converting a MAC address into a latitude and longitude. As their names suggest, one uses Google, the other Skyhook Wireless.
I'll explore several approaches since they tend to give slightly different answers, with the quality depending on the AP's location and the coverage of the databases involved.
Dr. Andrew Davison
E-mail: ad@coe.psu.ac.th
Back to my home page
/HTML>