23 May, 2024

Geofences reinvented

Introducing the brand new flespi entity.

Geofencing is a major functionality of any GPS tracking platform since the most important part of telemetry from any telematics device is coordinates. With geofencing, you can convert these numeric coordinates into meaningful location information specific to you — a home, office, school, customer N, road to heaven, border, parking checkpoint, gas station, city S, or even country X.

Flespi was initially presented to the public in 2017. In 2019, we released an analytics system and provided the functionality to control device position with user-specific geofences. In 2022, we introduced device plugins, and one of the first plugins was the geofence detection plugin, which adds user-defined names of geofences to device messages.

Both in the calculator and in the plugin, a set of geofences was defined as part of its configuration. Simple and convenient, but with some limitations:

  • It’s not possible to edit just a single geofence — you have to send them all at once.

  • There are some limitations — for example, in a calculator, you cannot define more than 64 geofences per calculator, and in a plugin, you cannot define more than 1,000 geofences.

  • There are no simple ways to reuse geofences between multiple plugins or calculators.

These are constraints of the architecture when a geofence is part of a plugin or calculator and does not exist as an independent entity.

Now, in 2024, after receiving many requests about these constraints from users building their platforms and applications on top of flespi, we decided to make geofencing simpler and more powerful by designing and implementing a new dedicated flespi entity — the geofence.

I don’t want to dive too much into their functionality as, in my opinion, geofences are the most obvious entity in flespi. I’d like to highlight some interesting and prospective projects you can now use flespi for with the new geofencing functionality.

Marking messages and controlling millions of geofences

The new geofencing functionality is backed by the efficient R-Tree spatial index and is incredibly quick. For your application, this means that you can now mark device messages with user-specific location names or detect location visits for millions of geofences without any effort.

Apply user-specific metadata in geofences

As a dedicated flespi entity, geofences have metadata where you can store any custom information linked to the geofence. For example, if you define a maximum speed limit in the metadata, you can control geo-based overspeeding events.

Use geofences in plugins and streams

Geofences provide hit test results as a function call in flespi expression. From a user perspective, you can enable location-based activation/deactivation of streams and plugins. For example, only stream device messages when the device is inside or outside a certain location.

“With great power comes great responsibility”. Or in other words, geofences have a price tag, just like devices, channels, streams, and plugins. For all commercial plans, we provide 1,000 geofences for free (included in the base plan price) and charge 1 EUR per month for each extra 100 geofences.

At the same time, the old-fashioned geofences that are part of plugin or calculator configurations are available as usual, and we have no plans to restrict them. It’s up to you which flespi geofencing system to use.

If you want to switch a calculator or plugin to new geofences, the algorithm is as follows:

  • Create geofences. You may copy the geofence’s geometry configuration as the geometry format is unchanged — it is still a circle, polygon, and corridor.

  • Assign geofences to the plugin or calculator. You can automate this assignment by adding geofences to the corresponding group.

  • Disable built-in geofences configuration in the plugin or calculator by deselecting the geofences option.

From that moment, the plugin or calculator should be switched to the new geofences. You can revert changes just by reactivating the geofences option in the plugin or calculator configuration.


Geofences are not rocket science. But they are a must-have element for any location-based system. Now, flespi has this component reinvented according to actual market needs, and you’re welcome to use it as a building block in your solutions!