Banner
Where are you from? IP Geolocation
Written by Harry Fairhead   
Tuesday, 07 July 2009 14:00
Article Index
Where are you from? IP Geolocation
MaxMind's GeoLite
Making it work
Getting the IP
All Pages

 

Knowing where a website visitor is located is vital if you hope to have a chance to provide information that is geographically relevant. In the case of I Programmer, the problem was to pinpoint a user's location so that best Amazon locale could be used to retrieve book pricing details in the correct currency and shipping rates. The obvious solution is to ask the user but, guess what, users really don't like to be asked things. Indeed if confronted by a pop-up window demanding that they divulge where they are they might just go away without ever finding out if the site offers anything useful.

 

For some reason most users are paranoid about revealing any information, no matter how innocent and harmless even if it could be beneficial. So, we need an automatic way to determine with reasonable accuracy where the user is. We also need a facility to override the choice - users for some reason are always pleased to correct personal data that you have wrong even if they won't supply it in the first place!

Google Gears Gelolocation API

The most obvious thing to do is to use some sort of IP address to location mapping, but this isn't the only option. You can make use of GPS, WiFi location and, if the client is connected via mobile phone, cell location. In fact it makes good sense to put all of these methods together to provide a more accurate location.

This is exactly what the Google Gears Gelolocation API does and in the future or for applications that need very accurate location information - as good as 200m -this might be the way to go. But for many applications having to include yet another JavaScript library and work with another API and online provider is just too much. I opted for a simpler solution that was quicker to implement and didn't add any load to the clients network connection as the whole job is don't on the server via a PHP script. In the future I might have to re-think.

<ASIN:0596007035>

<ASIN:0321518667>

<ASIN:0470097779>



Last Updated ( Thursday, 16 July 2009 12:55 )
 
     
Banner
Copyright © 2010 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.