What is the best way to get geo-location in Java (freely if possible)?
Update: Not from a GPS device. Basically how Firefox 3.5 / HTML 5 does it
What is the best way to get geo-location in Java (freely if possible)?
Update: Not from a GPS device. Basically how Firefox 3.5 / HTML 5 does it
The biggest database of WiFi-to-location is probably SkyHook Wireless, used by Apple and Google for their geo-location. There are SDKs available - see http://skyhookwireless.com/developers/.
If you need a local database, you can check out what IPInfoDB has to offer.
If you can use a web service, there are a number out there, but I'm not sure what their Terms of Service allow. A Google search for "ip geolocation lookup web service" turns up some stuff, but many of them are commercial products and you would have to read their ToS carefully to make sure you use them within the guidelines.
If you want to know how Firefox 3.5 (or Google Chrome) gets the geolocation, then please take a look here: How Google/Firefox Geolocation API works
Basically, what Firefox 3.5 (as well as Chrome) does is to get the list of nearby Wi-Fi networks and send that list using JSON to a Google webservice, which will then return the approximate coordinates.
By the way, there is no Java involved in this process. To get geolocation from Firefox/Chrome, you just call a few JavaScript methods. (I really hope that you know that Java is different from JavaScript)
If I understand well enough, you want to get the geographic location of visitors to your site or web application. The alternatives I know are:
Google Gears has some functions to make GeoLocation(http://code.google.com/apis/gears/api%5Fgeolocation.html), but need to install Gears
Using JavaScript functions that call an online service such as IP Location Tools (www dot iplocationtools dot com). The site has examples and even have a video tutorial.