# Geofence

A geofence is a virtual "perimeter" or "fence" around a given geographic feature. A geofence can be dynamically generated (as in a radius around a point location) or match a predefined set of boundaries (such as school zones or neighborhood boundaries).
The use of a geofence is called geofencing, and one example of use involves a location-aware device of a location-based service (LBS) user entering or exiting a geofence. Geofencing approach is based on the observation that users move from one place to another and then stay at that place for a while. This method combines awareness of the user's current location with awareness of the user's proximity to locations that may be of interest. This activity could trigger an alert to the device's user as well as messaging to the geofence operator. This info, which could contain the location of the device, could be sent to a mobile telephone or an email account.

## History

Geofencing was invented in the early 1990s and patented in 1995 by American inventor Michael Dimino, using the first-of-its-kind GPS and GSM technology for tracking and locating anywhere on the globe from a remote location. Cellular geofencing for global tracking is cited in the United States Patent Office over 240 times by major companies such as IBM and Microsoft since 1995 and is first mentioned as:
   A global tracking system (GTS) for monitoring an alarm condition associated with and locating a movable object, the GTS comprising:
       a cellular telephone located with the movable object;
       a GPS (global positioning system) receiver located with the movable object, the GPS receiver being effective for providing data reflecting a present spacial position of the movable object, in terms of spacial latitude/longitude coordinates;
       an interface between the GPS receiver and the cellular telephone, the interface being connected between the GPS receiver and the cellular telephone and including circuitry for transmitting the spacial coordinates from the GPS receiver through the telephone, wirelessly to a remote location; and
       an alarm for detecting that the object has been moved, by calculating a spatial movement of the object which exceeds a predetermined distance based on information supplied by the GPS receiver, and the alarm initiating the transmission to the remote location the spatial coordinates from the GPS receiver when said movement of predetermined distance has been detected.

## Working

Geofencing uses technologies like GPS, or even IP address ranges, to build its virtual fence. In most cases, mobile phones are using combinations of positioning methods, e.g., Assisted GPS (A-GPS). "A-GPS uses assistance data received from the network to obtain a faster location calculation compared with GPS alone." The global system of tracking and geofencing is supported by a group of subsystems based on global navigation satellite system (GNSS) services. Both horizontal and vertical accuracy of GNSS is just a few centimetres for baseline ≤ 5 km. The Wide Area Augmentation System (WAAS) is used by devices equipped and used in North America—the accuracy is considered to be within 3 m at least 95% of the time. These virtual fences can be used to track the physical location of the device active in the particular region or the fence area. The location of the person using the device is taken as geocoding data and can be used further for advertising purposes.
It is possible to monitor several geofences at once (multiple active geofences). The number of active geofences on Android devices is limited to 100 per app and per user. It is possible to monitor different type of triggering activity for each geofence separately—entrance, exit, or dwell in the monitored area.

## Types

There are two types of geofencing—choice of type depends on the purpose of using geofencing in a given situation.

### Active

It uses GPS services for the entire time when the application is running and therefore consumes more battery as a result. The reason for the higher battery consumption is the fact that the service requires running in the foreground throughout the time of usage.

### Passive

This type does not require a constantly active state of the application and is able to run in the background. It is rather suitable for the process of data collection. It does not use GPS services, therefore cannot be used for an app depending on real time (sending notifications immediately, etc).

## Pros and cons
### Advantages

* It is not necessary to implement any additional hardware for this method to function.
* This service is available for both Android and iOS operating systems.
* When properly implemented, you can expect accuracy in units of metres.

### Disadvantages

* Higher battery consumption
* Before it is possible to start using the geofencing method, it is necessary for a user to allow location tracking.

## Applications
### Policing

The FBI has used geofence warrants to identify rioters who participated in the 6 January Capitol attack.

### Safety

Geofencing, used with child location services, can notify parents if a child leaves a designated area.
It is also being used for flexible home controls and monitoring system—for example setting a phone to unlock the door or turn on the heating when arriving home.
Geofencing used with location-based guns can restrict those firearms to fire only in locations where their firing is permitted, thereby making them unable to be used elsewhere.
Other applications include sending an alert if a vehicle is stolen, and notifying rangers when wildlife stray into farmland.
A geofence can be used for location-based messaging for tourist safety and communication.
In 2015, US Senator Charles Schumer proposed a law requiring drone manufacturers to build geofencing constraints into unmanned aerial vehicle navigation systems that would override the commands of the unsophisticated operator, preventing the device from flying into protected airspace.

### In the workplace

Geofencing is critical to telematics. It allows users of the system to draw zones around places of work, customer's sites and secure areas. These geofences when crossed by an equipped vehicle or person can trigger a warning to the user or operator via SMS or email.
In some companies, geofencing is used by the human resource department to monitor employees working in special locations, especially those doing field works. Using a geofencing tool, an employee is allowed to log his or her attendance using a GPS-enabled device when within a designated perimeter.
Geofencing, in a security strategy model, provides security to wireless local area networks. This is done by using predefined borders (e.g., an office space with borders established by positioning technology attached to a specially programmed server). The office space becomes an authorized location for designated users and wireless mobile devices.

### Satellite

During the use of Starlink satellites in the Russo-Ukrainian War, SpaceX used geofencing to limit the use of Starlink Internet services outside the borders of Ukraine such as in Russian-occupied territories in Ukraine.

### Advertisement

Applications of geofencing extend to advertising and geomarketing. Geofencing solution providers allow marketers and advertisers to precisely choose the exact location that their ads show up on. Geofencing uses different types of targeting to identify zip codes, street addresses, GPS coordinates using latitude and longitude, as well as IP targeting.
Geofencing enables competitive marketing tactics for advertisers and marketers to grab the attention of in-market shoppers in their competitive store location, large scale events such as concerts, sports events, conferences, etc. in stadiums, convention centers, malls, outlets, parks, neighborhoods. For example: at a concert, a digital ad relating to the performer or an affiliated company could be sent to only those people in the venue.
For example, a local auto-dealership builds a virtual boundary within a few square miles from its dealership's location to target car buyers within the same neighborhood. This way they limit their ad spending on prospects who are more likely to purchase in order to get a better ROI. Using tracking technologies to identify devices where the ads were shown, geofencing solution providers are able to provide walk-in attribution for their advertising. This means that using a geofencing solution, companies can now track the customers who walked into the showroom after seeing the ad. This level of attribution provides better visibility and analytics for marketers to spend their advertising budget wisely.
A local service business may only be interested in (a) likely clients (b) within a service region or catchment basin. Broadcasting or advertising more extensively brings irrelevant responses and wastes energy, time, money, and opportunity. Electronic advertising can identify and target only desired market objects (people).

## Business

Target Corporation settled for $5 million with the San Diego City Attorney in April 2022, promising to audit and improve pricing procedures, after a San Diego complaint that the company used geofencing to raise prices when a customer entered a store.