Geolocation solutions on the web

...ok, so you want a killer web app that will locate the position of the current visitor? No problem. Here are the tools of the trade. (Your requirements may vary, for me, i want Lat/Long information, with regards to the KISS principle)

1. IP to location databases
Typical providers include ip2location, ipligence, maxmind. They are usually expensive, static, and just too big. The concept is that you have a big database downloaded and monthly updated, and you can open that database to get the location info from whatever platform you want. Since IP addresses change dynamically i just don't see this method viable. You might consider them, if you need the information in an offline environment. Note that some of these providers offer a webservice also, to query results online. More about this later.

2. REST based services
You send an HTTP request and you get a parseable result with the information. I just tested NetGeo of these kinds. It is not maintained for several years thus giving pretty bad results (putting my Budapest location to Amsterdam).

3. REST based javascript APIs
I didn't really know how to name these. The principle is that you include a remote javascript file, and based on the requestor's IP the returned javascript code will contain a few function calls with the results already built in. For example in my case it will contain lets say a function my_city() {return 'Budapest';}. Extremely simple to use, maxmind and geoplugin offers such services.

4. The W3C API
It is expected that in the future all modern browsers (not counting IE ;) ) will conform to the emerging W3C standard. How will they do it? Its their problem, you just simply call a javascript function and have your Lat/Long info ready. At the moment the upcoming Firefox 3.1 seems to support this natively(!), while older Firefoxes can have the Geode plugin to produce similar results. I only tested Geode, but as it exclusively relies on WiFi positioning, without any fallback method, either it gives you some results (i never saw one), or it just flatly fails.

5. Other browser extensions
Gears have the ability to tell your location, so if you expect your visitors to have the Gears extension, you might as well rely on this. Simple and gave me a good result.

6. Combined methods
An interesting approach can be found here. It first tries to use the native API, secondly one of the extensions (including Gears), lastly it falls back to Google loader ClientLocation. Although the code is not very elegant and it has to include a lot of external files upfront, it is an approach that can gain some ground pretty soon.

7. Fire eagle [UPDATE]
Yahoo created fire eagle with the purpose to control what applications can access what level of location information (You have the same control with #4). Both the user and the consuming application has to be registered at the fire eagle website. The user is "responsible" to keep his location up to date either manually or with the use of an external application, and whenever an application tries to access this information, the user has to allow it through the fire eagle website. Under the hood FE tries to locate you automatically with method #4. I had one pain using FE: you cannot drag and drop the pinpoint of your location freely, and since it was not very confident with my address (Yahoo maps apparently has a typo in my street name), i couldnt set my exact location.
UPDATE2: There is an article on how to build an app to use FireEagle, you might find it useful.

Any other methods? Feel free to comment. For me, i will stick with #3 for now.
Happy geolocating!


Anonymous said...

I believe FireEagle can be used for this kind of a job, and it seems to have a decent user base as well and apps for patching your location to it for different devices.

maschek said...

Yes, it is a rather different approach than the ones mentioned above. It is worth a bullet, i will update the entry:)
Thanks, Jani!

Anonymous said...

Great read! Thanks for all the information, this will come in handy.

Anonymous said...

There are other alternatives to the shareware IP to location databases you mentioned. I work for Quova, a provider of IP geolocation data. Unlike some vendors who provide static databases with information gleaned from registries, Quova has patented algorithms and a team of Network Geography Analysts that map the ever-changing Internet infrastructre and ISP allocations of IP addresses. We provide real-time updates to our customers. Our database of more then 2 billion IP addresses changes anywhere from 2-7% a week! As you mentioned, we do offer a web service and our pricing is based on the number of queries to our database, similar to cell phone minutes.
Kerry Langstaff, VP Marketing, Quova, Inc.