Geolocation

Web Architecture [./]
Fall 2011 — INFO 253 (CCN 42598)

Dilan Mahendran, UC Berkeley School of Information
2011-09-27

Creative Commons License [http://creativecommons.org/licenses/by/3.0/]

This work is licensed under a CC
Attribution 3.0 Unported License
[http://creativecommons.org/licenses/by/3.0/]

Contents D. Mahendran: Geolocation

Contents

D. Mahendran: Geolocation

(2) Abstract

Mobility is (one of) the key defining characteristics of mobile devices, and many use cases and scenarios not only depend on mobility (the ability to move), but on location (the knowledge of where something moved to). Determining the location of a mobile device can be done in a variety of ways, and in this lecture we briefly look at various localization technologies (IP address, Wi-Fi, cell phone, GPS). We then look at the W3C Geolocation API, which is currently under development and allows scripting code to request the location of the device it is running on. Finally, we discuss some privacy issues around automated access to location information.



Location-Based Services (LBS)

Outline (Location-Based Services (LBS))

  1. Location-Based Services (LBS) [2]
  2. Determining Location [11]
    1. IP Positioning [2]
    2. Wi-Fi Positioning [2]
    3. Cell Phone Tower Positioning [2]
    4. Global Positioning System (GPS) [3]
  3. Geolocation API [6]
  4. Location Privacy Issues [3]
Location-Based Services (LBS) D. Mahendran: Geolocation

(4) Mobility and Geolocation



Location-Based Services (LBS) D. Mahendran: Geolocation

(5) Desktop Location

google-maps-my-location.png

Determining Location

Outline (Determining Location)

  1. Location-Based Services (LBS) [2]
  2. Determining Location [11]
    1. IP Positioning [2]
    2. Wi-Fi Positioning [2]
    3. Cell Phone Tower Positioning [2]
    4. Global Positioning System (GPS) [3]
  3. Geolocation API [6]
  4. Location Privacy Issues [3]
Determining Location D. Mahendran: Geolocation

(7) Where Are You?



Determining Location D. Mahendran: Geolocation

(8) Connectivity Matters

IP address from local Wi-Fi:

<Response>
 <Ip>128.32.226.183</Ip>
 <Status>OK</Status>
 <CountryCode>US</CountryCode>
 <CountryName>United States</CountryName>
 <RegionCode>06</RegionCode>
 <RegionName>California</RegionName>
 <City>Berkeley</City>
 <ZipPostalCode>94720</ZipPostalCode>
 <Latitude>37.8668</Latitude>
 <Longitude>-122.254</Longitude>
 <Timezone>-8</Timezone>
 <Gmtoffset>-8</Gmtoffset>
 <Dstoffset>-7</Dstoffset>
</Response>

IP address through AT&T 3G:

<Response>
 <Ip>166.205.136.159</Ip>
 <Status>OK</Status>
 <CountryCode>US</CountryCode>
 <CountryName>United States</CountryName>
 <Latitude>38</Latitude>
 <Longitude>-97</Longitude>
 <Timezone>-6</Timezone>
 <Gmtoffset>-6</Gmtoffset>
 <Dstoffset>-5</Dstoffset>
</Response>


IP Positioning

IP Positioning D. Mahendran: Geolocation

(10) Internet Addressing

  • Basic Internet connectivity requires IP addresses
    • each device connected to the Internet has an IP address
  • IP addresses are assigned and used in blocks
    • Class A [http://en.wikipedia.org/wiki/Classful_network#Introduction_of_address_classes] networks are assigned to a few big entities [http://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.xhtml]
    • other classes are less wasteful but still assigned in blocks
    • identifying a block's owner can be done through public registries
  • IP has (almost) run out of addresses several times [http://en.wikipedia.org/wiki/IPv4_address_exhaustion]
    • the IP address space has only 4 billion addresses [http://courses.ischool.berkeley.edu/i153/s11/internet#ip-address]
    • because of IP's design, optimal allocation of addresses is not possible
    • various fixes have been developed and deployed since the mid-1980's


IP Positioning D. Mahendran: Geolocation

(11) IP Address Problems

  • Modern network technologies made IP addresses less reliable
    • Network Address Translation (NAT) hides device IP addresses to the outside world
    • Dynamic Host Configuration Protocol (DHCP) makes IP addresses less static
    • Virtual Private Network (VPN) technology assigns internal addresses for external devices
    • phone-based access makes IP addresses only useful on the national level
  • IP addresses are still useful as a fallback and for stationary devices
    • big organizations often have a well-defined location and IP addresses
    • for location on the regional level this often is good enough
  • IP addresses are almost useless for phone-based connectivity
    • some carriers may support additional technologies (WAP)


Wi-Fi Positioning

Wi-Fi Positioning D. Mahendran: Geolocation

(13) Wi-Fi Networks

  • Wi-Fi networks have unique identifiers
    • Media Access Control (MAC) which uniquely identifies each manufactured device
    • Service Set Identifier (SSID) which is not unique but publicly visible and reasonably good
  • Wi-Fi networks have short range and thus provide good localization
    • maximum indoor range of 802.11n is 70m (230ft)
    • maximum outdoor range of 802.11n is 250m (820ft)
  • Wi-Fi networks are widely deployed and easy to identify/scan
    • Wardriving [http://en.wikipedia.org/wiki/Wardriving] started the trend of collecting Wi-Fi information
    • big databases nowadays contain tens of millions of Wi-Fi networks


Wi-Fi Positioning D. Mahendran: Geolocation

(14) Open Wi-Fi Databases

wigle.png

Cell Phone Tower Positioning

Cell Phone Tower Positioning D. Mahendran: Geolocation

(16) Mobile Internet Access

  • Most mobile connectivity nowadays is via cell phone networks
    • cell phone technology has had data support for a long time
    • WiMax and similar data-centric technologies are not yet widely established
  • Localization can differ greatly based on various factors
    • cell phone technology (CDMA has wider range than GPS)
    • topology (hilly areas require more towers but make localization harder)
    • coverage (densely populated areas have more towers)
  • For emergency calls localization is required by law
    • known as Enhanced 911 (E911) [http://en.wikipedia.org/wiki/Enhanced_911] in the U.S.
    • implemented under different names in various other countries


Cell Phone Tower Positioning D. Mahendran: Geolocation

(17) Location Provider

  • Cell phones see various towers
    • cell phone tower triangulation can be done with tower IDs
    • this requires nothing but the ability to get to tower IDs
  • Towers receive traffic from cell phones
    • Cell of Origin (COO) only use one tower's location
    • Time Difference of Arrival (TDOA) triangulates between synchronized towers
    • Angle of Arrival (AOA) allows towers to detect the origin of the signal
    • AOA-based localization requires additional equipment in the towers
    • AOA-based localization can only be done by the cell phone operator
  • Some cell phone operators provide their own location services
    • E911 is required by law
    • additional services such as Verizon's Family Locator [http://products.verizonwireless.com/index.aspx?id=fnd_familylocator_features]


Global Positioning System (GPS)

Outline (Global Positioning System (GPS))

  1. Location-Based Services (LBS) [2]
  2. Determining Location [11]
    1. IP Positioning [2]
    2. Wi-Fi Positioning [2]
    3. Cell Phone Tower Positioning [2]
    4. Global Positioning System (GPS) [3]
  3. Geolocation API [6]
  4. Location Privacy Issues [3]
Global Positioning System (GPS) D. Mahendran: Geolocation

(19) Military Technology

  • Long-range ballistic missiles need global navigation
  • Cold war technologies were often visionary and expensive
  • GPS was conceived in the mid-1970's and development started soon
    • first experimental satellite launched in 1978
    • 10 experimental satellites were launched to validate the concept
    • new generation of satellites launched in 1989
    • initial operational capability was achieved in December 1993
    • Selective Availability (SA) was switched off in 2000
  • Satellite-based means global availability
    • satellite orbit is 20,200km (12,550 miles)
    • signal strength is low and receivers need line of sight


Global Positioning System (GPS) D. Mahendran: Geolocation

(20) GPS Satellite Visibility

gps-animation.gif

Global Positioning System (GPS) D. Mahendran: Geolocation

(21) GPS Precision

  • GPS positioning precision depends on various factors
    • Selective Availability (SA) was switched off in 2000 (limit to 100m)
    • satellite reception quality (15m precision with optimal reception)
  • Augmentation services can enhance precision dramatically
    • WAAS/EGNOS/MSAS achieves precision in the 3m range
    • Differential GPS (DGPS) achieves sub-meter precision
    • Nationwide Differential GPS (NDGPS) is a DGS operated by federal agencies
    • Real-Time Kinematic (RTK) achieves centimeter precision (even in elevation)
  • Accuracy information given by receivers often is wrong
    • it reflects the receiver's local model (satellite reception)
    • external influences (distorted signals) can have a strong effect


Geolocation API

Outline (Geolocation API)

  1. Location-Based Services (LBS) [2]
  2. Determining Location [11]
    1. IP Positioning [2]
    2. Wi-Fi Positioning [2]
    3. Cell Phone Tower Positioning [2]
    4. Global Positioning System (GPS) [3]
  3. Geolocation API [6]
  4. Location Privacy Issues [3]
Geolocation API D. Mahendran: Geolocation

(23) W3C Geolocation API basics


function get_location() {
navigator.geolocation.getCurrentPosition
(show_map); 
}



Geolocation API D. Mahendran: Geolocation

(24) W3C Geolocation API

function show_map(position) { 
  var latitude = position.coords.latitude; 
  var longitude = position.coords.longitude; 
  // show a map etc.
 }


Geolocation API D. Mahendran: Geolocation

(25) Geolocation API Demo

<!DOCTYPE html>
<html>
 <head>
  <title>Minimal Geolocation Demo</title>
 </head>
 <body>
  <h1>Minimal <a href="http://www.w3.org/TR/geolocation-API/">Geolocation</a> Demo</h1>
  <p>You are <span id="location">somewhere</span>.</p>
  <script type="text/javascript">
   navigator.geolocation.getCurrentPosition(function(position){
    var lat = position.coords.latitude;
    var long = position.coords.longitude;
    var coord = "at (" + lat + "," + long +")";
    document.getElementById('location').textContent = coord;
   });
  </script>
 </body>
</html>


Geolocation API D. Mahendran: Geolocation

(26) Geolocation-Based Image

<!DOCTYPE html>
<html>
 <head>
  <title>Geolocation and Maps</title>
  <script src="jquery.js" type="text/javascript"></script>
  <script type="text/javascript">
   $(document).ready(function() {
    $("p").click(function() {
     navigator.geolocation.getCurrentPosition(function(position){
      var lat = position.coords.latitude;
      var long = position.coords.longitude;
      $("p").after("<img src='http://maps.google.com/maps/api/staticmap?center=" + lat + "," + long + "&amp;zoom=16&amp;size=512x512&amp;sensor=false'/>");
     });
    });
   });
  </script>
 </head>
 <body>
  <h1><a href="http://www.w3.org/TR/geolocation-API/">Geolocation</a> and Maps</h1>
  <p>Are you curious where you are? Click here!</p>
 </body>
</html>


Geolocation API D. Mahendran: Geolocation

(27) WGS84 Coordinates (World Geodetic System)

interface Position {
	readonly attribute Coordinates coords;
	readonly attribute DOMTimeStamp timestamp;
};
[http://www.w3.org/TR/geolocation-API/#position_interface]
interface Coordinates {
	readonly attribute double latitude;
	readonly attribute double longitude;
	readonly attribute double altitude;
	readonly attribute double accuracy;
	readonly attribute double altitudeAccuracy;
	readonly attribute double heading;
	readonly attribute double speed;
};
[http://www.w3.org/TR/geolocation-API/#coordinates_interface]

Geolocation API D. Mahendran: Geolocation

(28) Geocoding and Reverse Geocoding



Location Privacy Issues

Outline (Location Privacy Issues)

  1. Location-Based Services (LBS) [2]
  2. Determining Location [11]
    1. IP Positioning [2]
    2. Wi-Fi Positioning [2]
    3. Cell Phone Tower Positioning [2]
    4. Global Positioning System (GPS) [3]
  3. Geolocation API [6]
  4. Location Privacy Issues [3]
Location Privacy Issues D. Mahendran: Geolocation

(30) Handling Privacy



Location Privacy Issues D. Mahendran: Geolocation

(31) Sensitive Data



Location Privacy Issues D. Mahendran: Geolocation

(32) Location Fuzzing



2011-09-27 Web Architecture [./]
Fall 2011 — INFO 253 (CCN 42598)