The iPhone has the ability to triangulate the physical location of the phone using a combination of GPS and Phone tower ID points. Some people have been asking me if it could be possible to find the location of a user’s computer when they view a web page. Since every computer uses a unique IP number, and that number is registered in blocks to internet service providers, then it could be theoretically possible to reverse lookup these numbers to get an approximation as to where they are.

*You cannot know exactly where the person is as accurately as GPS, but instead get a general approximation. This could have some interesting uses, especially since the cost for this technology is relatively small.
*Physical proximity and distance can be calculated using the haversine formula. This will tell us the distance between two points on a sphere. And of course, the earth is not flat, so typical straight line calculations are pretty useless. Thankfully, the formula is quite simple:

First we get the radius of the earth in either miles or kilometers:

R = 6371 km radius of the earth

Next, we calculate the delta or change between the latitude and longitude points:

Δlat = lat_{2}− lat_{1 }

Δlong = long_{2}− long_{1}

Finally, we plug those givens into the formula:

a = sin²(Δlat/2) + cos(lat_{1}) * cos(lat_{2}) * sin²(Δlong/2)

c = 2 * atan2(√a, √(1−a))

d = R * c

For the purpose of this experiment, we also need a data table with the values of IP numbers and their proximity to lat long points in the world. MaxMind has generously provided a free data set of city points for this very purpose. After loading the data points and creating a script that pulls the browser’s IP number, the page gets a list of data back. The detail and quality of the data depends on the data set coverage. However, so far in testing, the results are pretty good for the minimal effort put into the coding.

Uses for something like this could include:

– Add immediate locational feedback on web site analytics without log processing

– Provide web site browsers with geographically specific services

– Provide geographically tailored content on front pages

– Restrict content based on geographic location

Weburban LLC is an iPhone, and Android development studio based in the San Francisco Bay Area, California.

### Like this:

Like Loading...

*Related*