Basics of Geofence Implementation

Imagine you are near your favorite restaurant or coffee shop and you receive a mobile coupon from them.  Or you receive a notification that your child or pet is outside of specific area/region. Or you’re able to track a valuable piece of luggage that’s lost within the airport.  How do all these examples work? Through the application of geofence and LBS (location-based services). Modern apps and products are becoming smarter by adding geofence intelligence, so let’s take a look a its applications and basic implementation.

What is a geofence and geofencing?

A geofence is a virtual fence or boundary that’s placed around a real-world location. It can varying size, from encircling a small store to covering the an entire city. It can also vary shapes, from circles to polygons.  However, most geofences are created for a specific area or point of interest.

A geofence can be used once the geolocation data of an entity is available. The geolocation data could be available on any GPS-enabled device, like a smartphone or a car with GPS-enabled hardware. The data can then be used by a product or app to understand the location of the phone or car and provide services based on this information.

Once the geofence is created, the product or app can set up triggers, which then send a text message, email alert, or app notification when an entity under observation enters (or exits) the geofence.

Creating this  geofence and setting up the triggers is called as geofencing.

Applications of Geofencing

There are many ways geofencing can create a valuable customer experience. The retail, fleet tracking, and hospitality industries are prime candidates for geofencing. . Other examples of its uses include:

  • Proximity-based marketing: When a user is near a store, they could receive special offers, win back campaigns, rewards, reminders, or shopping tips. The user’s previous purchase data could be used to send a message about relevant in-store items or a possible sale on their favorite brand.
  • Location-based services: When a user is near a service point and their car is up for service, send a message to remind them of the upcoming service or provide an incentive offer to come in.
  • Asset tracking: When an asset that has a GPS enabled device attached to it is entering/exiting a specific geofence.
  • Track a child or pet: When a child or pet is exiting the home or safe place and enters into an unfamiliar place, a device can send parents an alert message. AngelSense and Pod Tracker are existing wearable solution for kids and pets, respectively.These products support the geofencing feature.

Geofencing enables the creation of unique user experiences that  are specific to the context of the location.

Basic geofencing implementation

The crux of good geofencing is smart alert/notification generation depending on the location of an entity and whether they are entering or exiting the geofence. Let’s call it a geofence transition. Here is an example of how to support this entering and exiting:

  • Store the geofence data as multiple coordinates for a polygon geofence or as a radius and center point coordinate for a circular geofence.
  • Check if the current location coordinate (latitude, longitude) of an entity is entering or exiting a geofence.
  • To find out if an entity is entering or exiting, check if last location coordinate of the entity was inside or outside of the geofence.
  • If the last location coordinate of an entity was outside of the geofence and the current location coordinate of the entity is inside the geofence, then the entity is entering the geofence.
  • If last location coordinate of an entity is inside the geofence and current location coordinate of the entity is outside the geofence then the entity is exiting the geofence.

This querying of a location coordinate happens multiple times in order for the data to stay accurate. There are also more complex ways to find out if a location (latitude, longitude) is inside or outside of a geofence. Other solutions include:

  • Google maps API, please refer documentation here.
  • Geofenceapi provides rest API’s to easily build and query custom geofences using longitude & latitude.
  • Geofencing as a service https://fencer.io/.

There are also a few ways to detect geofence rule violations:

Leverage existing solutions or implement in-house?

It’s recommended to use existing solutions when the need is urgent or when you’re evaluating geofencing for Minimum Viable Product (MVP) or proof of concept.

Implement geofencing in-house when you need to use it frequently or when higher accuracy provided by in-house solutions is absolutely required for the product.

Product teams should also consider the following before making a decision:

  • Implementation and maintenance cost.
  • The accuracy of geofence query results.
  • The ability of a solution to scale.

More reading:

The following articles provide detailed step-by-step implementation of geofencing in iOS and Android

(Reference: geofence Image for the article is taken from “http://www.geomarketing.com/wp-content/uploads/2016/03/pic14.png”)

Learn More about Encora

We are the software development company fiercely committed and uniquely equipped to enable companies to do what they can’t do now.

Learn More

Global Delivery

READ MORE

Careers

READ MORE

Industries

READ MORE

Related Insights

Enabling Transformation in Hospitality through Technology-Led Innovation

As the exclusive sponsor of the 2024 Hotel Visionary Awards, we support organizations leading ...

Read More

Key Insights from HLTH 2024: The Future of Patient-Centered Healthcare

Discover key insights from HLTH 2024 on digital health, AI in diagnostics, data interoperability, ...

Read More

Data-Driven Engineering: Transforming Operations and Products from Insight to Impact

Discover how data-driven engineering transforms operations and product development, enhancing team ...

Read More
Previous Previous
Next

Accelerate Your Path
to Market Leadership 

Encora logo

Santa Clara, CA

+1 669-236-2674

letstalk@encora.com

Innovation Acceleration

Speak With an Expert

Encora logo

Santa Clara, CA

+1 (480) 991 3635

letstalk@encora.com

Innovation Acceleration