Reputation: 5353
Could anyone explain to me why when I allow HTML5 Geolocation Demos to use my location it always returns New York, however, when I go on my phone it shows my exact position? I am trying to implement a 'current location' function on my website, though I don't know if it is possible.
Thank you
Upvotes: 1
Views: 218
Reputation: 10799
There are a number of pieces of additional information available to your phone that can be used to determine your location more accurately than on a typical wired desktop. Notably:
Generally speaking, GPS when available is likely to give the highest accuracy. With a clear view of the sky, most phones can geolocate you using GPS to within 5 meters or less.
Companies like Google/Apple have information matching known AP SSIDs/MAC addresses to geographic locations. A phone is able to send information off to a service (such as Google's geolocation API) about the APs it can see and their signal strength. The service returns an estimate of location based on what it knows about those APs and any proprietary algorithms the service provider uses to determine location based on AP signal strengths.
Much like Wi-Fi information, your phone can send off cell tower visibility/signal strength information to a service which can estimate location based on what it knows about the cell towers under consideration.
Here's an example of what a phone might send off to Google's geolocation service (copied verbatim from the link):
{
"version": "1.1.0",
"host": "maps.google.com",
"home_mobile_country_code": 310,
"home_mobile_network_code": 410,
"radio_type": "gsm",
"carrier": "Vodafone",
"request_address": true,
"address_language": "en_GB",
"location": {
"latitude": 51.0,
"longitude": -0.1
},
"cell_towers": [
{
"cell_id": "42",
"location_area_code": 415,
"mobile_country_code": 310,
"mobile_network_code": 410,
"age": 0,
"signal_strength": -60,
"timing_advance": 5555
},
{
"cell_id": "88",
"location_area_code": 415,
"mobile_country_code": 310,
"mobile_network_code": 580,
"age": 0,
"signal_strength": -70,
"timing_advance": 7777
}
],
"wifi_towers": [
{
"mac_address": "01-23-45-67-89-ab",
"signal_strength": 8,
"age": 0
},
{
"mac_address": "01-23-45-67-89-ac",
"signal_strength": 4,
"age": 0
}
]
}
Note that some of the information in the example is even more detailed than what I've described. But you probably get the idea about the kind of hints regarding location that a typical modern phone provides that a desktop machine can't.
From my personal experience, Wi-Fi/Cell tower based geolocation is not as accurate as GPS, but can be quite good. For example on a base model iPad without a GPS chip, I can often get accuracy within 50 meters based off Wi-Fi/cell towers alone. In more densely populated Wi-Fi areas (e.g. in the city) I imagine the accuracy is even better and will continue to get better over time.
Upvotes: 1
Reputation: 60942
Your phone has a GPS radio that can narrow your location down to within ten or so meters. Your computer (generally) has no such capability. Your browser can use information like your IP address to get close to your actual location, but it can't achieve anything like your phone's precision.
Upvotes: 3