Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So far I know how to grab the client location to a application or web application by using the users geolocation or GPS location. I remember the possibility of finding the users approximate location by using their IP address. How is this done if you know how it is done can you link me to a tutorial or spec in addition to a short description?

Edit (Added Picture):
enter image description here

Edit: Possibly found through ISP?

share|improve this question
up vote 3 down vote accepted

There's a good explanation at this blog post There are essentially four ways it's done by browsers.

  1. GPS. Duh
  2. AGPS. Use phone towers to triangulate the position
  3. WiFi. Use available known wifi networks to triangulate the position
  4. IP Address databases. As has been noted above.
share|improve this answer
+1 Thanks, It looks like Geolocation uses 1-3 and is agnostic to the underlying sources of location information according to its requirements. That was one interesting article. Once again thanks! – dkroy Jul 25 '11 at 7:29

Try Maxmind's GeoIP or Quova's webservices. They have free and paid databases of ip address ranges to approx lat/lon.

share|improve this answer
Thanks this answer got me on the correct track I believe. – dkroy Jul 24 '11 at 8:01

Due to Ragi's links in his answer I was able to piece together how the IP Address location is done. The 3rd party organizations have a Database mapping where there is some relation to the location to the ISP and as a result IP ranges. This seems to be a dying technique since HTML5 is becoming more supported and GPS's are being put into more and more portable devices.

The three client locating techniques:
1. GPS Location (GPS integrated devices)
2. Geolocation (HTML5 enabled browsers/devices)
3. ISP-Location database mappings (Third Party API's)

IP to Location Libraries/API:
GeoBytes - PHP/Web Service

I am going to leave this question open for a day since I may be wrong and I will probably no longer be using this third technique in concert with Geolocation.

share|improve this answer

Despite I agree that GPS location is the best, but most website are still accesed from desktop or laptop devices. Laptops can figure out an approximate location based on wireless networks, but the user have to give his consent that his location is traced. I bet that 50% won't do this unless they really know what you do with their location. IF you want to trace it to give him differential content or targeted ads then he probably won't accept.

If you have a service that need exact location then you can ask for their permission, if not, then they can leave as your service is based on the location.

If you want to know their location for other purpose: content, ads, statistics, then the best way is to use a geolocation API, so you don't have to hassle with all the database thing. I've noticed that the ipgp geolocation API to be the most accurate:

share|improve this answer

you can look this extension for gps web gate... mobile-gps-web-gate

and i use this code for my mobile app....

// navigator.geolocation.getCurrentPosition(successCallback, errorCallback, options)
navigator.geolocation.getCurrentPosition(function(position) {
      var location = [, position.address.region,].join(', ');
      createMap(position.latitude, position.longitude, location);
}, function() {
      document.getElementById('cantfindyou').innerHTML = "We dont find you!";
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.