## 5 replies

Last post Oct 20, 2011 01:15 PM by iyju

• ### smartit07

None

0 Points

11 Posts

Is it possible to calculate distance between two computer based on IP address?

Participant

1530 Points

416 Posts

### Re: IP Address Distance Calculation

Hi,

Yes it's possible. First you need to use some webservice to get latitude an longitude of ip address.

I am using this service for one of my projects.

And then use this formula to calculate distance:

x = [sin(lat1/57.2958) * sin(lat2/57.2958)] + [cos(lat1/57.2958) * cos(lat2/57.2958) * cos(lon2/57.2958 - lon1/57.2958)]

Regards,
Viktar Karpach

MCPD Web Developer,MCTS SQL Server 2008,MCTS .NET 2.0-3.5 Web Application
ASP.NET C# Technical Blog

Participant

831 Points

229 Posts

### Re: IP Address Distance Calculation

http://www.seomoz.org/ip2loc <- Built in AJAX.

Good luck finding something that is open source for ASP.

Don't forget to click "Mark as Answer" on the post(s) that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
Be obscure clearly. -- E.B. White

All-Star

67417 Points

6760 Posts

### Re: IP Address Distance Calculation

May 05, 2008 03:14 AM|Vince Xu - MSFT|LINK

Hi,

I'm agreed with karpach96 .

1. Convert IP address to Location via IP to Location Web Service. Such as using IP2Location.

2. Calculate the distance between two Latitude/Longitude points. You can check the below link.

http://www.movable-type.co.uk/scripts/latlong.html

3. If you want to get city name via Latitude/Longitude points. There is an available way to achieve it is to find a Web Service which can return to you the latitude according to city name.

And the below one might be helpful for you:

There are several formula and codes for calculating in the above link.

Hope it helps

Member

78 Points

252 Posts

### Re: IP Address Distance Calculation

I have used your formular however all I get back is are values such as .009485. No whole number. Is there something else that is needed for this formular to work correctly? Also, I have replaced the brackets with "(" since it I get an error with them installed. Thank you.

Member

21 Points

5 Posts