![]() |
All things geolocation ...
A few threads have recently come up (again) about geolocation ( geoip ), so I thought I'd give a few pointers and an example of how easy it is.
First off, maxmind's geoip database is probably the best option as it's free. However, it requires installation, which isn't easy and if you want to query specific IP addresses, you can't use the apache module. So you end up using the PHP or Perl modules, which are *really* frikken slow. So, for those not wanting to go that route, geoplugin.com has a webservice that uses Maxmind's data (the free database for the webservice as maxmind refuse to allow their paid database for direct external IP lookups). This webservice is a bit better than simply using the maxmind geoip db as it also returns data on nearby places to a location and a currency converter. To use geoplugin, there's a really easy to use PHP class, that even the brain-dead person can add to their pages. Someone recently asked about GeoIP adverts for their dating site. If anyone wants the script that displays the image below (you can choose your own images, but these ones are public domain and royalty-free images), just give me a shout and I'll send it on. An example geo-localised advert displaying your city (as seen by maxmind's geoip db) and places around you. [/PublicServiceAnnouncement] |
And if I find anyone hotlinking that gif, I'll come and cut your nuts off, cos I said I'd give you the script for free, ya lazy bandwidth-hogging freeloaders :winkwink:
|
Great for me, its only 1500 KM off position.
|
Never seen geo dating ads do surrounding areas, which seems like something obvious... guess someone has to think of it first! :D How do you determine the surrounding cities, is that part of the maxmind db too?
(I don't recognise any of the names in your sample because my geo IP loc pretty much always shows me in another state) |
Quote:
|
Quote:
Don't worry lol my connection always shows the Spanish mainland not my real offshore location. |
Quote:
$theta = $lon1 - $lon2; $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta)); $dist = acos($dist); $dist = rad2deg($dist); $miles = $dist * 60 * 1.1515; $unit = strtoupper($unit); Surrounding areas can be turned off in that add image: Nearby ON: http://www.geoplugin.com/geoexamples...rl/geogirl.gif and with Nearby OFF: http://www.geoplugin.com/geoexamples...gif?nearby=off |
Running your php code on my server?
I don't think so... no thanks. |
Quote:
|
Quote:
Jeese, some people are so damn suspicious. Would it make you feel better if I charged you $100 for it :1orglaugh |
Quote:
There are online lookups, like terraserver.net (free), and Microsoft's Mapthingy (paid) that can be used. I just fancied a home-grown one and so went the *very* long route. see http://www.geoplugin.com/webservices/extras I was going to open it up to allow for radius changes, but the cpu spikes if some tit puts in a massive radius, so I left it at default 10miles. |
borked
Why are you offering a service thats using your server for free ? |
because there are lots of things I do which aren't for commercial gain.
This particular venture was because when I was doing something that used geo stuff a long long time ago, I was frustrated as hell as to how difficult it was to do. So I set this up to help others. No ulterior motives at all. People that use it are programmers, and that's what it's all about. |
You can also use the Net_GeoIP package + Cache_Lite from PEAR. That's what I use and cache per IP. If anyone wants to know how to use that, hit me up. My results thus far have been very accurate using the free Maxmind DB.
Good post regardless Borked. Why aren't you ever on icq/aim anymore? |
Or you can just download the free db and the scripts they provide, upload it behind the web and ask your host to set that dir as global. Now just echo out the geoip call to anything, page, script, picture, with a single line.
|
whadya mean? Course I'm on!
BTW, do some benchmarking with Net_GeoIP compared to a C wrapper or the apache module - net_geoip is dog slow.... When you compile the maxmind source, look in the examples folder - there's a cool shell script in there. Modify it a bit to take into account the new values, like continent code and some other new things, then have php call that script and parse the output. Far far faster for querying specific IP addresses. Bit overkill to gain a few msecs, but thought I'd throw it out there. I needed to go that route, as I'm doing a shit load of lookups per day, so the diff between 1usec and 10msecs is huge. |
Quote:
|
borked
Thanks for the inspiring post, your php class has given me some new ideas for our flight info, weather and exchange rate feeds. I will probably end up using a paid for geo service but for now your class is a great experimental tool. |
Quote:
|
Quote:
|
original post
|
Quote:
Just cos it's free, doesn't mean it's crap though :winkwink: If you need any help with your project, give me a shout |
Dopy, just so you know (which isn't documented anywhere), queries are limited to a rate of 60/minute, which has never caused any probs amongst those that use it. If you hammer away at a faster rate than that, you'll get blacklisted for 1hr.
I had to implement that, cos it was being abused. |
Quote:
But if someone can download and setup this up then setting up and using what maxmind provides for free isn't going to trip the person up. Personally, I purchase the City DB, some hosts provide it free. Anyway, Konrad took the base Maxmind scripts, made a couple quick adjustments and all was set. Over the last several years we have shared the setup with lots of people. No host, program or Webmaster has ever came back saying it was slow. Not saying what you have won't work like a champ, I'm sure it will.. But the real basic setup and use of GEOIP is easier than setting up a Web Form. |
Quote:
|
Doc -
Yeah, fair enough. Was just showing that the class outputs the "Nearby" stuff and the inbuilt currency converter, things that aren't simple at all to do and certainly imposs with maxmind. The thread wasn't meant as a sales pitch at all, but was just making the point that it can be real easy, since there have been a few posts recently that have shown that it is quite difficult for some (and some don't even have dedi boxes to install the stuff on) |
Quote:
|
it says Nijmegen (NL), while it should be Dronten (NL)
|
same here is says either Den Haag or Ypenburg both in NL, not even close, considering the Netherlands is a small country but both are at least 50KM or more off.
|
You guys are missing the point - geolocation by IP at the city level is never going to be 100% accurate, and especially so for small countries. If your in a small country, the ISP is going to be less likely to group IPs by city and simply assign an entire block to a very large region.
Accuracy wasn't the point of the thread :2 cents: |
Quote:
http://www.pinaccesscode.com/gtib_ig...to_enter_$.gif Both the banner and underlying site automatically appear in one of 45 languages:pimp |
Quote:
Language-localised ads are a must imo. Geo-localising anything is pointless if you aren't displaying the text in the user's preferred language. |
Quote:
|
Man it pisses me off when people quote the distance that your geo targeting is off, as if that has anything to do with anything. All that proves is ignorance on how the technology works.
|
Usefull...! thanks.
|
hmm cool man this is the most accurate geo i saw ... everytime it was at least 50km, now you are 5 km from my location, great keep up the good work! :thumbsup
|
Awesome service Andy! Been using this for some time and love it..
|
Great information in this thread!
Thanks borked |
Top work borked, will defo be trying this out
|
Quote:
Quote:
If you wanted to help programmers, you would release the full code, both on the client and server side. :2 cents: |
Quote:
If you don't agree with his principles or methodology, don't use the service. Noone is forcing you :) |
Of course I won't use his service. :2 cents:
|
Quote:
I couldn't give a toss if you use it or not tbh, but there is zero financial gain or incentive in this operation, whether you believe it or not :2 cents: |
Quote:
|
All times are GMT -7. The time now is 06:22 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123