Advanced Geofencing with TomTom Maps
Geofencing represents a location-based virtual boundary or barrier for mobile devices. A geofence draws a virtual boundary on a map’s real geographical locations. When a device crosses this boundary, an application triggers predefined responses or actions, like creating alerts or sending messages that indicate the user's proximity to locations of interest. This enables us to determine whether a device is within or outside of a predefined geographical area.
Using geofencing in map applications is very effective in modern applications. Geofencing technology uses location services provided by the capabilities of GPS or RFID or even Wi-Fi and cellular data. It’s an essential technique used widely in business activities based on customer location, such as targeted marketing. Targeted marketing identifies who to promote products and services to through identifying the channels that are likely to reach those potential customers.
Other uses are in applications that display notifications and messages when a device is within a specific type of location, like an airport or supermarket. This technology helps passengers know when their drivers are approaching and alerts business owners when their deliveries arrive.
Geofencing applications depend mainly on APIs that provide the ability to define geofences (geometric perimeters drawn on the map) surrounding areas of interest. Mobile device sensors can detect a user’s exact location to know whether they enter the specified geofence — and trigger specified actions if they do.
Despite all these capabilities, many developers make minimal use of geofences. Most draw geofences as simple squares and circles. However, they can be much more than that.
TomTom’s Geofencing API offers a great example of this. It extends geofencing with more advanced features, making it applicable to more use cases. Its practical additions include searching for points of interest (POI) (like the odd-shaped outline of a building or parking lot) and creating corridors (straight or curving lines with width to mark a pathway or roadway) to gain more sales, engagement, and customers. In the following sections, we’ll explore some advanced geofencing features using the most popular and most used Geofencing API and the Maps SDK for Android.
Identify Key Locations with POI Search
Many applications provide product offers or specific promotions to consumers with mobile phones when they visit a shopping center, market area, or particular geographic location. We can call these “interest areas” or POIs. A specific map location is vital for businesses to send relevant messages to potential clients who enter these predefined locations or geographic areas. For example, a point of interest could be “Sun City Mall” or “Hyde Park,” which are well-known, publicly accessible sites. Other common POIs include restaurants, hotels, and stadiums.
TomTom’s POI search capability allows application users to search for addresses and interesting areas quickly and simply. This POI search saves time with a one-step search function for a predefined location, versus forcing the user to look up a location in a search API and waiting for the app to draw a geofence around it.
For example, consider an application in which we define a geofence (using the Geofences Creator) around an airport as a point of interest (POI). When a flight boarding time is approaching, and the device crosses the specified POI (drawn around the airport in this case), our application displays a notification that directs the user to get a boarding pass.
To use TomTom’s geofencing service to search for a place, we must define virtual barriers on real geographical locations marked as points of interest. Then by determining the location of an object, we can know whether that object is within, outside, or close to a predefined geographical area, which is our POI.
Since any object with connectivity can be geofenced by implementing a global search or near-me search in our application, we expect the output to be a list of general search results, points displayed on the map, or triggers to perform predefined actions.
With TomTom’s Geofencing API, fences can be of any shape (circle, rectangle, corridor, and polygon) or size and have multiple user-defined attributes. We can also search for a POI and receive its shape boundaries instead of drawing the geofence manually. Additionally, we can get a location report for a given radius that contains a list of nearest fences that the object is inside or outside, regardless of the selected radius.
TomTom’s handy Geofences Creator helps us easily create and edit geofences using the Geofencing API. We simply move the map to the desired location, pick our shape, move our pointer to the desired radius, and click again. We then name our geofence, choose our settings, and we are done. Additionally, we can search for a POI or city name to quickly get a predefined geofence for that location.
The Geofencing API interacts with other APIs, such as the Location History API. They share the consentForStoringObjectsPositionsHistory endpoint. By setting the endpoint’s value to true, both services can save an objects' position. After sending a position through the Geofencing API and triggering a transition calculation, a service sends the latest previous position no matter which service sends it. The figure below shows a sample of trip events information provided by an application.
Polygons offer greater precision and flexibility for shapes with straight-line sides in more complicated scenarios. For example, a use case could be planning a trip to London, finding a suitable hotel, and choosing a nice restaurant in that neighborhood. Using the POI details endpoint, we could get information such as price ranges, ratings, reviews, social media details, and contact information. Also, we can search for specific types of places using the Category Search. Because of the POI photos endpoint, we can also investigate the look and feel and the atmosphere of the areas of interest.
When we use the Maps SDK for Android, the FuzzyLocationDescriptor class can provide all these features by instantiating objects using the FuzzyLocationDescriptor.Builder function. We can see how a POI search quickly provides more details to the user instead of only displaying shapes like circles and polygons. It can quickly tell us when a user enters or exits a specified geofence.
TomTom’s POI Search can precisely determine when a client enters or exits a dwelling or a store, tracking location precisely rather than approximately. It also can determine how long the person is inside. This feature has many uses, especially in the days of the COVID-19 pandemic, allowing us to design applications that monitor people’s gathering points, such as shopping malls, restaurants, cafes, and markets.
We can also build an application that helps make parking payments easy by monitoring car arrivals in parking lot geofences. These geofences could trigger automatic payment and the opening and closing of parking barriers. While most of the process would happen server-side, you might prompt visitors to confirm before you charge them:
Another application dedicated to transportation may use the outstanding accuracy and precision provided by TomTom’s POI Search. For example, geofencing can be used to connect riders and drivers, ensuring they can locate one another quickly and effectively. It can also trigger alerts to riders as their driver approaches so they can ensure they are prepared to get in the vehicle as soon as it arrives.
Another use case for the POI search, which may save a lot of time for managers, is to use geofences to send an alert when employees enter unauthorized places. Or, location tracking technology can be used as a replacement for attendance time cards.
Using POIs and geofences supports various marketing activities, logistics planning, and crowd management strategies.
Track Journeys with Corridors
A corridor geofence includes a path with a radius. This path can be a straight line or take many twists and turns. The radius determines the thickness of the line. Corridors are ideal for tracking paths, like roadways and rivers.
For example, we can use a corridor on a road to track how many cars come and go. A wider corridor may track every lane on a highway, while a narrower corridor may track a single-lane street. With multiple corridors, we could even measure travel time across all major roads inside a city.
By using corridors to analyze roadways where travel times are slow due to congestion, government authorities can use reliable data to make decisions about traffic management.
In a POI search, the Corridor Filter can return a list of POIs that fall along the route. Additionally, the returned results may contain information regarding the distance and time from the route. There are a variety of corridor use cases. For example, we can use them for highways, roads, and streets. So, if a vehicle exits a geofence, we can set up an alert that it’s gone off course.
We can also use corridors to see the flow of where people are going. In addition, we can use corridors to identify high traffic areas and walking paths. These use cases emphasize the high precision and accuracy provided by corridors to geofence a strip of a road, rather than using ordinary circles as geofences.
Maximize Geofencing by Combining Both Tools
We can combine the POI Search feature with corridors to gain maximum precision and accuracy. For example, combining these tools provides high value for tracking a truck’s journey to highway distribution centers. We can use corridors to track the highway route and POI search to identify the precise perimeter of each distribution center.
Tracking the route with corridors enables us to track how much time drivers spend on major roads and trigger alerts when they deviate from their intended course. The POI geofence around the distribution center allows us to track when assets have reached their destination.
We can also use larger geofences around the distribution centers to indicate when the driver is getting close. This lets us alert the distribution center that the driver is approaching, so they can get ready and open the docks.
We can apply the same concept in many applications, such as tracking customers or packages. Using corridors alongside the POI Search feature gives excellent results, providing a variety of applications with higher precision and accuracy.
In conclusion, geofencing is more than just drawing simple circles and shapes on maps. With TomTom’s Geofencing API, its potential extends to a wide range of advanced features.
We’ve discussed POI Search and corridors — and their many applications. In addition, we explored how we can combine these features to achieve a high level of precision and accuracy. This lengthens an already long list of application uses, such as targeted marketing, traffic management, vehicles and fleet tracking, airline applications, mobile restaurant orders, audience engagement, human resource attendance control, and even social networking and smart homes.
Sign up for a TomTom developer account and start creating your own geofencing applications.