

Ask HN: how is browser geolocation so precise? - rorrr

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.<p>I just asked my wife, who is traveling abroad, to try it, and it also pinpointed her within 50 feet.<p>Try it yourself - go to google maps, click on the dot above the orange man icon.<p>I have no idea how it works so well.<p>I tried IP to location services, and none of them are even close. Most of them are 40-70 miles off.
======
byoung2
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.

~~~
LogEx
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.

------
arkitaip
""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...](http://google-latlong.blogspot.com/2009/07/blue-circle-comes-to-
your-desktop.html)

~~~
rorrr
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.

~~~
Samuel_Michon
_"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.

~~~
rorrr
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.

~~~
gst
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.

------
LogEx
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.

~~~
LogEx
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.

------
brg
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.

------
systemtrigger
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.

------
Geee
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.

~~~
rorrr
Hmmm, yes, my wife used her iPhone. But who is "they"? Who has my precise
coordinates?

~~~
DenisM
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.

~~~
rorrr
What's the "mothership"? I tried Chrome, FF, Opera and Safari - all of them
showed my exact location.

~~~
DenisM
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.

------
joezydeco
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?

~~~
rorrr
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.

~~~
dfc
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?

~~~
byoung2
_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>

~~~
rorrr
Nope, maxmind detects my location incorrectly (25 miles off).

~~~
byoung2
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.

------
swah
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.

------
notatoad
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.

------
wlievens
For me it's off by more than 1 kilometre.

