4 ms·
Ask HN: How are IP addresses geocoded to latitude and longitude?
There are a bunch of API services out there that are able to determine the latitude and longitude (and other data, e.g. state, city, etc.) for a given IP address. How are they able to do this? How does one know what part of the world an IP address is associated with?
- Joyfield 12y agoFirst of all you can do a whois on an IP address to get where the company that registered is located. If you traceroute the address you can sometimes get hints on where it is. And then some big sites may use geo locotation services on their websites that query the browser/APP GPS where the user is located and then it may be concluded that the whole /24 net is within that area and then the site will sell this information to geo location services.
- willvarfar 12y agoYou can download a DB with this info here: http://dev.maxmind.com/geoip/geoip2/geoip2-csv-databases/ http://dev.maxmind.com/geoip/geoip2/geoip2-csv-databases/ I integrated that into my own webserver so I get fun logs; there's a tingle when you see people reading your own posts after all. You can also buy a bigger, better DB from the same people.
- tonylemesmer 12y agoThis is a useful piece of information but I think the OP is asking how it is technically achieved. i.e. how was the database created in the first place.
- jbranchaud 12y agoExactly. I am curious from a technical standpoint how a company/service is able to figure out the coordinates associated with a given IP address.
- davismwfl 12y agoUsually they use a data provider/library like maxmind or a few others. If the question is how someone like maxmind or others assemble that data it is usually done through a mix of ARIN, data aggregators and ISP data. ARIN will give which ISP and which country it is assigned to. ISP's generally have blocks regulated to specific areas of the country, e.g. mine is "RR-SOUTHEAST-BLK2", as I am on brighthouse, and that block has 67.8.x.x in it. And data aggregators purchase data from ecommerce and other sources to gather location data on individuals and their IP's. This is then aggregated, split and sold in many ways. There are also some companies/startups working on GEO location to be able to target a person on any device based upon knowing the IP's they have used and some algorithms around the user-agent of the browsers etc. This means they can target you with marketing based upon who you are and your purchase history. *EDIT: As for lat/long, ZIP codes in the US have a centroid lat/long as assigned by Tiger data (and others). So they will use that as a starting point, and if an aggregator has purchased your data from someone they may be able to get the lat/long even closer through the matching algorithms.
- Someone1234 12y agoGood-ish article in this Stackoverflow article[0]. The short version is: Any website that has your location (e.g. city, address, etc) can sell that data on and do. In the US in particular there are nearly no data protection laws (except healthcare records). So companies "share" data with impunity. [0] https://stackoverflow.com/questions/1996106/how-does-ip-geolocating-work https://stackoverflow.com/questions/1996106/how-does-ip-geol...