Ask HN: how is browser geolocation so precise?

29 points by rorrr ↗ HN
I'm in the middle of nowhere, connecting through cable, google maps doesn't even have the street view anywhere within 40 miles, my laptop doesn't have a GPS. Yet my browser geolocates me exactly. And I mean EXACTLY, it points to the house I'm in.

I just asked my wife, who is traveling abroad, to try it, and it also pinpointed her within 50 feet.

Try it yourself - go to google maps, click on the dot above the orange man icon.

I have no idea how it works so well.

I tried IP to location services, and none of them are even close. Most of them are 40-70 miles off.

34 comments

[ 2.6 ms ] story [ 94.1 ms ] thread
""So how does it work? When you activate the My Location feature, Google Maps asks your web browser for your location. Typically, your browser uses information about the Wi-Fi access points around you to estimate your location. If no Wi-Fi access points are in range, or your computer doesn't have Wi-Fi, it may resort to using your computer's IP address to get an approximate location. As you'd expect, the accuracy of My Location varies with your location, and in some cases, Google Maps may not be able to provide a location at all.""

http://google-latlong.blogspot.com/2009/07/blue-circle-comes...

That doesn't really answer anything.

In my case, there's no wifi, I'm on cable. So it must use my IP. Yet all other IP->location services I've tried are not even close.

I'm asking because I'm writing some code that would benefit greatly from such precise geolocation. Unfortunately that browser thing (navigator.geolocation.getCurrentPosition) only works after your user explicitly allows to share his location, which is annoying at best.

"In my case, there's no wifi, I'm on cable."

But is your computer's WiFi receiver turned off? If not, that's how Google knows where you are. They have an enormous database of MAC addresses of WiFi access points and their geographic location. Many of those were gathered while taking StreetView pictures, others are provided by companies like Skyhook Wireless.

I have a wired connection (fiber optic) so I usually leave WiFi turned off. After reading your question, I tried the geolocator in Google Maps. It couldn't find me at all. Once I turned on WiFi, it knew exactly where I am. After I turned WiFi off again, Google still knew my location, but only in the web browser that I used before.

Yes, I do have a router, but I doubt google has visited us, we only recently moved here. There's no street view anywhere near here, as I said.
OK, if Google didn't drive by, then another company could've -- or perhaps someone used an Android device near your house.

For instance, check this map to see whether Skyhook Wireless has wardriven by your house: http://www.skyhookwireless.com/howitworks/coverage.php

And again, they don't need your router. You just need to have a WiFi receiver in your computer, turn it on, and your computer will scan for nearby networks. The MAC addresses of your neighbors' networks are checked against those in Google's database. If Google finds three or more, it knows exactly where you are.

Google does not need to visit you as the collect this data over the Android phones. So basically if there's a single Android user with WiFi enabled (but with GPS disabled) they already know your approximate location (due to the GSM cellid). If that happens multiple times they can use triangulation to increase the accuracy of this data. And if there are some Android users with GPS enabled that "see" the WiFi access point, Google can pinpoint the location very very accurate.

It's possible to disable this "feature" in the Android settings, but I guess most users don't bother changing this.

If an Android phone has wireless location settings enabled, it will also report the locations of wireless access points to google. So someone with an android phone has seen your access point, and it has uploaded the position.
rorrr: Just deal with it. Its set that way so that a user can grant you the permission to ASK EXACTLY WHERE THEY ARE.

You can provide a prompt to allow the user to give you permission, but seriously? Its ridiculous that you're complaining about security =p

How do you know Google isn't using other cross-referenced data to find you? Do you use other Google services that might have your address? What does Mapquest or Bing show as your location?
Because I tried it without google, just using this:

    navigator.geolocation.getCurrentPosition(callback)
Gives you the same precise coordinates, in all browsers I've tried.
Clear your cache and run tshark when you send the request. See what data it sends.

I do not understand how it could nail your house with just your IP. Do you have a cellular connection built into your laptop? What ISP? Maybe your ISP shares data with google?

I do not understand how it could nail your house with just your IP

If you've submitted contact information (mailing address, billing address) on a site that partners with MaxMind, then you may have provided them your exact address and IP. I'm sure Google must use this as one of their geolocation sources.

http://www.maxmind.com/app/ip-location-explained

Nope, maxmind detects my location incorrectly (25 miles off).
Keep in mind that this would be one of many data points Google pieces together to get the most accurate location. MaxMind is 1000 feet off for me (likely because the data was incomplete because of privacy scrubbing), but spot on with Google Maps (down to my location within my condo complex). Some other data points that would give Google this information are Google Maps on my Android phone. With explicit permission to read and report my coarse (network-based) and fine (GPS) location, it would be able to read any WiFi access point in range of my phone and link that with my exact GPS location and report that to Google. I leave this enabled at all times for Google Latitude. I would imagine that anyone with a smartphone and Google Maps who came near enough to your house could have reported your access point and GPS location to Google. Even if you don't have WiFi, if the neighbors on both sides of you do, they could extrapolate that to your house in the middle.
I'm on cable, and my results both in google maps and with this call are highly general. (City Level / accuracy: 24000) We've had this cable account for years and many different people have used it so it's interesting that neither the street view car nor MaxMind have pinpointed it.
The html5 geolocation API allows your browser to share your location using the most accurate source available. On a smartphone, this is the GPS antenna (when it's on), cell tower triangulation, or WiFi geolocation. The WiFi location works because you can register your location on sites such as Skyhook, and Google collects this data when they drive the street view cars around. On a desktop or laptop, this is usually WiFi or IP address (keep in mind you don't have to actually join the network, just be in range of one, so it could be a neighbor's). With IP addresses, you can very accurately determine the country, and a general region, since IP blocks are usually assigned to ISP's, so if you are a cable customer, you can be traced to the nearest hop from your house, which will be about a 50-100 mile radius in most of the US. For a more accurate position, here's where the privacy concerns come in. There are companies like MaxMind that gather data on individual IP addresses. In their words:

MaxMind partners with various websites where users are asked to enter some form of geographical location information. The IP address and location data are forwarded to MaxMind after all personally identifiable information have been scrubbed to protect privacy concerns. MaxMind then runs millions of these IP location pairs through a series of algorithms and programs that identify, extract, and extrapolate relevant associations between IP address and geographical information.

Source: http://www.maxmind.com/app/ip-location-explained

So think about that the next time you fill out a form online. When you put in your billing address, they are collecting your physical location and tying it to your IP address. Even if they aren't getting full address to IP lists, they could at least calculate that certain ranges apply to certain streets.

MaxMind shows my location as 25 miles to the south.
This one of the reasons I like dynamic IP and change my IP address regularly. So my IP-geolocation location jumps all over my metro area on a regular basis.
Have you used a GPS device in that house with that IP address? That's one possibility how they might have acquired the location. Same thing if someone accessed your Wi-Fi using a GPS device.
Hmmm, yes, my wife used her iPhone. But who is "they"? Who has my precise coordinates?
Well, there's your answer. iPhone sends GPS coordinates, wifi mac address, cell tower ids, and IP address to the mothership. Your browser can then send the same IP, and MAC, to get back the GPS location.
Because she used Google Maps over her home wifi with the GPS turned on?
"iPhone sends GPS coordinates, wifi mac address, cell tower ids, and IP address to the mothership."

Apple does collect this kind of data, but they don't sell it (and especially not to Google). The Maps app on the iPhone doesn't send this data to Google either.

Apple built the Maps app themselves, they only use Google's map data. It's in Apple's interest to keep the data they've collected to themselves, they're using it to build an alternative to Google Maps.

It could have been anyone who came within range of the wireless router with a smartphone. That could be a postal carrier, electric or gas company meter reader, UPS/FedEx delivery person, you name it.
What's the "mothership"? I tried Chrome, FF, Opera and Safari - all of them showed my exact location.
Skyhook. They used to be the world's largest database of wifi MAC->GPS mapping. Apple us building their own (as is Google and probably many others), but they are probably still handing some queries (and data) over to Skyhook when their own database is found lacking.
I would wager you are pinpointed because you are using wireless, and the Google streetView car recorded the name of your access point. They need not have made streetview of your area online, but it is likely if you are in the US or Canada that they did drive by. There are also other companies collecting this data, so it may not be just Google's.

Browser geolocation uses the id and signal strength of wireless access points. But as mentioned in this thread already, that is only one of many signals including your device's gps and rev-ip data.

you must have something running on your computer giving your location. my browser can only find me to within about 150km. theoretically, they should have me on skyhook or whatever because i've had the same wifi running for a couple years and streetview has been down my street.
I'm in Brazil and the same thing amazed me yesterday, through a service that was posted on HN that would let you see folks near you.
For me it's off by more than 1 kilometre.
(comment deleted)
It's because you're running OS X 10.6+ and your browser supports the HTML5 GeoLocation API. Snow Leopard introduced the CoreLocation API which periodically sends Apple the network addresses and strengths of all the WiFi routers near your mac, which returns your triangulated position.
Regardless of where you are, as long as you have wi-fi on and there's a wi-fi router nearby, even in the absence of street view cars or anything like that, all it takes is one person using a GPS-enabled device near you to geo-compromise your router (and in some cases, your wi-fi client devices). Apple, Google, and others use different databases, but if you are on a Mac, then any one person using GPS on iOS near your wi-fi access point has forever pinpointed it in Apple's databases, and when you use Mac OS X Location Services, it draws on Apple's MAC address-to-geolocation database. Similar for Android devices and Google. Or Microsoft devices and Windows.
Try this: turn off wi-fi on your computer and try again.

This is why I only use wi-fi when necessary, and also generally keep Location Services turned off on every device I own, unless I specifically need location.