Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Longitude and latitude value from IP address

Is it possible to get the longitude and latitude value from IP address in asp.net? If it is possible, please let me know how can I get this.

like image 910
Zerotoinfinity Avatar asked Apr 18 '10 18:04

Zerotoinfinity


People also ask

Can you find the longitude and latitude of an IP address?

IP geolocation is the mapping of an IP address to the geographic location of the internet from the connected device. By geographically mapping the IP address, it provides you with location information such as the country, state, city, zip code, latitude/longitude, ISP, area code, and other information.

Can you determine location from IP address?

The IP address routes Internet traffic to your computer. To clarify, it does not reveal your location. If someone was able to get your IP address they could learn a bit about your Internet service, such as which provider you use to connect to the internet, but they really can't locate you, your home, or your office.

How do I find the geo location of an IP address?

You may use 'traceroute' command to find clues to the location of the IP address. The names of the routers through which packets flow from your host to the destination host might hint at the geographical path of the final location.


1 Answers

MaxMind Geolite city is free. If it is not good enough, you can apparently upgrade to a more accurate paid-version. I can't speak for the quality of the paid version, as I have never used it.

If you like your SQL, download the CSV version. Load it into your database of choice, and query away.

The faster and space-efficient option is to download the file binary blob version of the same database, and then use the C# class to query it.

Alternatively, I have found ipinfodb.com to be useful. Query is by simple HTTP GET. For example, to geolocate stackoverflow.com try:

http://ipinfodb.com/ip_query.php?timezone=false&ip=69.59.196.211 

This will return an XML file containing latitude and longitude, that looks like:

<Response>   <Ip>69.59.196.211</Ip>   <Status>OK</Status>   <CountryCode>US</CountryCode>   <CountryName>United States</CountryName>   <RegionCode>41</RegionCode>   <RegionName>Oregon</RegionName>   <City>Corvallis</City>   <ZipPostalCode>97333</ZipPostalCode>   <Latitude>44.4698</Latitude>   <Longitude>-123.343</Longitude> </Response> 

Some VB.NET sample code is available at http://forum.ipinfodb.com/viewtopic.php?f=7&t=269

like image 185
fmark Avatar answered Sep 21 '22 11:09

fmark