PHP Classes

Beware of false data

Recommend this page to a friend!

      PHP Classes blog  >  PHP Tutorial to Detec...  >  All threads  >  Beware of false data  >  (Un) Subscribe thread alerts  
Subject:Beware of false data
Summary:Do not use IP geolocation for City, or latitude, etc.
Date:2015-12-16 18:30:35
Update:2015-12-28 18:45:11


  1. Beware of false data   Reply   Report abuse  
PHP-4-Business - 2015-12-16 19:47:34
Location identification based on IP should only be used for Country identification and not City or other more specific location information. Latitude, longitude, IDD code, etc are not reliable!

Your IP address is determined by your ISP's Data Centre. Their location is unlikely to be where YOU are! I'm frustrated with being offered "local services" which relate to the City where my ISP operates from and is half way across the country from me, and therefore totally useless!

Certainly use this for country detection (but even this may be wrong in certain places in Europe) but please do NOT use it for anything more exact.

  2. Re: Beware of false data   Reply   Report abuse  
Manuel Lemos - 2015-12-16 22:42:09 - In reply to message 1 from PHP-4-Business
Yes, unfortunately it is not possible to have 100% accuracy, especially now that users have mobile devices with location being changed all the time.

Still I think it may be more useful to get approximate location than no location at all. Just not assume it is accurate, especially if you are using the free version of the geolocation database.

  3. Re: Beware of false data   Reply   Report abuse  
Dave Smith - 2015-12-17 02:07:21 - In reply to message 1 from PHP-4-Business
It is the best we have, at the moment, that does not require users permission to access their geolocation.

If locality is important to the operation of your website, you should have a method for users to specify their location and drop a cookie to remember their choice. Use ip2location as a fallback when the location cookie is not present.


  4. Re: Beware of false data   Reply   Report abuse  
Manuel Lemos - 2015-12-17 02:15:08 - In reply to message 3 from Dave Smith
Yes, you can use HTML5 geolocation support but first you need user permissions, and second it may still not be very accurate if the user does not have GPS enabled.

  5. Re: Beware of false data   Reply   Report abuse  
PHP-4-Business - 2015-12-17 18:58:31 - In reply to message 4 from Manuel Lemos
I agree with the above. I just wish these data suppliers would stop providing all the 'unsafe' information.

They think they are being clever by providing a "rich data set", but all they are doing is enabling a poor customer experience. If the data are there then someone, sooner or later, is going to use it without considering whether it is wholly accurate ("it's in the data set so it must be true"!)


  6. Re: Beware of false data   Reply   Report abuse  
Manuel Lemos - 2015-12-18 00:14:32 - In reply to message 5 from PHP-4-Business
I did not see any of these geolocation data providers claim the data is 100% accurate. What I saw is that the paid versions are more accurate probably because they are more upto date, I am not sure.

Given that it is up to the user to make sensible use of data that may not be as accurate as necessary for certain applications.

I agree that some users may misuse data as if it is highly accurate, but that is their mistake, not the data provide fault.

Anyway, the article gives some examples of uses of this geolocation data, like adapting the content for the user country. That is an useful purpose that does not require greater accuracy.

For instance the PHP Classes uses IP2Location to determine the user country from his IP address. Still the user is prompted to confirm it.

The country of the user is used for many purpose like for instance show how the user is ranking in several types of rankings among the user of his country.

Also every month the site encourages users to help their country to rise in the Innovation Award Championship by country ranking. For some countries the site sends messages in the country official language to make it easier to explain. ...

  7. Re: Beware of false data   Reply   Report abuse  
Alexander Skakunov - 2015-12-28 00:54:36 - In reply to message 1 from PHP-4-Business
I agree that city data is not 100% accurate, but it's better than nothing.

You can also get region information which is A LOT.

What comes to lat\lng I agree, it's the coordinates of the detected city, not the coordinates of the IP itself (and this is confusing).

  8. Re: Beware of false data   Reply   Report abuse  
PHP-4-Business - 2015-12-28 18:18:41 - In reply to message 7 from Alexander Skakunov
I think it depends on the size of your country and its geographic make-up. For me the city data is worse than nothing. I often visit websites and get targeted adverts for "local" services which relate to the IP "City" which is over 200 miles away from where I am. That might not be far in some countries but in the UK that's a h-u-g-e distance; its not the nearest city to me, not even the second - in fact it's about the 8th nearest city!

Nor is it the same "region" ('County' in UK geographic terms) as me - it is 3 counties away from me.

Maybe in some countries you have to sign up with the ISP which is nearest to you (e.g. with your telephone provider), but that's not the case in the UK; I can choose an ISP at the other end of the country if I want.

In some cases 'any data' really is worse than nothing.

The only thing accurate on the IP2Location report for my IP is the Country and Timezone, and maybe that's all we need.

  9. Re: Beware of false data   Reply   Report abuse  
Manuel Lemos - 2015-12-28 18:45:11 - In reply to message 8 from PHP-4-Business
Yes, even though regional location may not be accurate many times, it may also be accurate many other times.

If getting regional location accurately is important to you, what you can do is to ask the user to confirm his location details. If it is right, he just confirms. If it is not right he can edit it.

I do that when setting the user country in PHP Classes.

For other situations on which you cannot ask the user, like showing geotargetted ads, the ads may be off site some times, but other times they will be correct. So there is value in this partially inaccurate data.