Community Blog PostgreSQL-enabled Electronic Fences: Application Scenarios and Performance

PostgreSQL-enabled Electronic Fences: Application Scenarios and Performance

In this article, the author discusses electronic fence technology based on PostgreSQL and describes its applications in various common business scenarios.

By digoal


"Electronic fence" is a concept commonly seen in geographic information system (GIS) applications and has wide application in many business scenarios.

A typical application of the electronic fence technology is to define one or more polygons. Some business rules may be triggered depending on whether a monitored object is inside or outside a polygon (according to the business model).

1) No-fly Zones

When flying a drone (for example, a DJI drone), you must avoid no-fly zones (NFZs) (or no-drone zones if you are in the US). Flying a drone in an NFZ is illegal, but you may not know where an NFZ is. Moreover, there are also different altitude limits in other regions.

Some manufacturers (DJI, for example) have programmed NFZs into their drones so that their drones won't take off in NFZs based on electronic fence technology. For example, when your drone flies near an NFZ, it can send an alarm to help avoid navigating into the NFZ.


2) Return Points of Shared Bicycles

Shared bicycles can also become a headache when they are piled up in areas they are not supposed to be in. A direct cause of this problem is that people can return the shared bicycles anywhere. Bicycle-sharing companies can use the electronic fence technology to specify accepted return points or non-accepted return areas. In this way, their customers can return bicycles to the nearest return points without affecting traffic or causing other problems.


3) Traffic Restrictions

To ease traffic jams and protect the urban environment, some vehicles are not allowed to enter some areas during specified periods.

For example, private cars subject to traffic restrictions are unallowed during peak hours or on particular days. Vehicles transporting construction waste or dangerous chemicals are unallowed to enter particular roads during specified periods. In the past, these restrictions were implemented by relying on cameras and police officers. The electronic fence technology makes things easier.


4) National Borders

National borders usually have clear geographical features. The combined use of electronic fence and stream computing technologies can detect exceptions in real time.


5) Business Territories

A long time ago, private bus drivers operated bus lines in some towns under contracts with the local government. According to these contracts, a registered bus can only operate on a specified line. Any driver who picked up passengers on a bus line operated by another driver will be reprimanded. This is about business territories. We can use the electronic fence technology to conveniently manage and control business territories that involve geographical information.

6) Online Punch Clock

Employees are allowed to punch in only after they enter the office area (electronic fence).

7) Remote Employee Management

A company can use the electronic fence technology to define some polygons for its regular office areas. When an employee goes outside a polygon, an event (an alarm, for example) is triggered.

8) Vehicle Management

The electronic fence technology can be used in the management of service cars and business cars. For example, when a car is driven out of a specified region, an event (an alarm, for example) is triggered.

9) Livestock Management

For example, animals in a cattle ranch can be tagged with GPS trackers that are configured with a specified electronic fence. When any animal goes out of the electronic fence, an event (an alarm, for example) is triggered.

10) Parolee Management

The electronic fence technology can be used to save the costs and labor involved in monitoring parolees. This can be complex and difficult because it involves human management, and the parolees may remove the trackers.

When every object is assigned a spatial property, many more scenarios can utilize the electronic fence technology. And there is so much to explore in terms of spatial data processing.

An electronic fence has many properties in addition to the spatial property. PostgreSQL provides the btree_gist module to allow creating composite indexes for spatial and scalar fields to improve performance.

PostgreSQL also supports spatial independence and exclusion constraints to prevent overlapping of electronic fences.

With decades of experience in spatial data management, PostgreSQL reliably provides high-quality spatial data management services and is devoted to facilitating human society development.

Performance of Electronic Fences

The electronic fence technology is commonly used to determine point-plane position relationships. Take the bicycle-sharing business as an example. To regulate bicycle parking, a bicycle-sharing company can specify points and areas (polygons) where returning bicycles (parking) is allowed or prohibited based on business requirements. When a customer returns a bicycle, the bicycle reports its location to the system. Then the system decides whether the customer can return the bicycle at this location by verifying whether this location falls in the allowed or prohibited area.

Tens of millions of polygons may be defined in this scenario.

It could be very challenging to verify whether a bicycle is inside or outside one of 10 million polygons.

PostgreSQL helps us tackle this challenge by providing a standalone performance of processing 25.1 billion requests for judging point-plane position relationships per day.

0 0 0
Share on


224 posts | 16 followers

You may also like