Geofences represent custom regions or places monitored in your project. Depending on your use case, a geofence might represent a retail store, a neighborhood, and so on.
Radar geofencing is more powerful than native iOS or Android geofencing, with cross-platform support for unlimited geofences, polygon geofences, isochrone (time-based) geofences, temporary geofences, and stop detection.
Geofences provides the following user context:
Geofences also provides the following events:
You can create geofences via the dashboard, CSV import, the API, nightly sync, or integrations.
Alternatively, if you don't have your own custom place data, Radar can detect when a user visits a place even if you haven't set up a geofence for that place. Learn more about Places.
Geofencing works in the foreground and in the background. All event generation happens server-side. This allows Radar geofencing to be more powerful than native iOS or Android geofencing, with cross-platform support for unlimited geofences, polygon geofences, isochrone (time-based) geofences, temporary geofences, and stop detection.
Radar generates a geofence entry event if a user enters a geofence (if stop detection is off) or stops in a geofence (if stop detection is on) with sufficient confidence, then a geofence exit event when the user leaves the geofence with sufficient confidence. A device must exit a geofence before a subsequent entry into that same geofence.
You can create geofences via the dashboard, CSV import, the API, nightly sync, or integrations. You can create geofences in the Test environment for development and testing, and in the Live environment for production.
You specify the metadata for geofences when you create them, including the tag (an optional group for the geofence, e.g.,
store), external ID (an optional external ID for the geofence that maps to your internal database, e.g.,
123), and description (a display name for the geofence, e.g.,
Geofences should be uniquely referenced by tag and external ID, assigned by you when a geofence is created. To disable or update metadata for a geofence, re-import the geofence with the same tag and external ID.
To create a geofence via the dashboard, go to the Geofences page and click the New button. Optionally search for an address or place, then enter a description, optional tag, optional external ID, and optional metadata. Choose circle to create a circle geofence, polygon to create a polygon geofence, or isochrone to create an isochrone (time-based) geofence. Click Create to create the geofence.
To create geofences via CSV import, go to the Geofences page and click the Import button. Then, select a CSV to upload.
The CSV must have 8 columns:
description: A display name for the geofence.
tag: A group for the geofence.
externalId(optional, but recommended): An external ID for the geofence that maps to your internal database.
type: The type of geofence geometry.
radius(required for type
isochrone): The radius in meters for type
circle, a number between
10000. The travel duration in minutes and travel mode for type
isochrone, a string in the format
15|carfor 15 minutes driving). Ignored for type
coordinates: A JSON string representing a center in the format
circle. A JSON string representing a closed ring of between 4 and 10,000 coordinates in the format
[[longitude0, latitude0],[longitude1,latitude1],[longitude2,latitude2],...,[longitude0,latitude0]]for type
polygon. A JSON string representing a destination in the format
isochrone. Note that longitude comes before latitude, a GeoJSON convention.
true, the geofence will generate events. If
false, the geofence will not generate events.
metadata: A set of custom key-value pairs for the geofence. A JSON string representing a dictionary with up to 16 keys and values of type string, boolean, or number.
Headers for the columns should be omitted. In other words, the first row of the CSV should correspond to the first geofence.
If a geofence with the specified tag and external ID already exists, it will be updated. If not, it will be created.
For example, to import a circle geofence representing a store and a polygon geofence representing a neighborhood, you could use the following CSV:
Again, note that longitude comes before latitude, a GeoJSON convention.
You can also create geofences programmatically via the API. You can create a geofence via POST
/api/v1/geofences, or upsert a geofence based on tag and external ID via PUT
For example, to upsert a geofence representing a store via the API:
Again, note that longitude comes before latitude, a GeoJSON convention.
Finally, you can sync geofences nightly from a CSV.
On the Radar Integrations page under Geofence Sync, set Enabled to Yes. Enter a Notification Email to receive success and failure confirmation emails. Then, choose a Protocol:
- Choose HTTP for geofence CSVs at public HTTP or HTTPS URLs. Enter the URLs of the geofence CSVs.
- Or, choose AWS S3 for geofence CSVs in a private S3 bucket. Enter an S3 bucket region, S3 bucket name, and the S3 object keys of the geofence CSVs. Finally, enter the AWS access key ID and secret access key of an IAM user with
GetObjectpermissions for the specified S3 bucket and objects.
Note that you can set separate CSVs for the Test and Live environments.
The geofence sync CSV format is the same as the geofence import CSV format.
When you click Save and Sync, Radar will attempt a one-time sync and send an email on success or failure. Radar will then attempt syncs nightly.
All geofence events have confidence levels. Confidence levels range from
1 (low) to
3 (high). Confidence is a function of the accuracy of the location reported by the device and the geometry of the geofence.
Confidence will be high when the user, taking into account the accuracy of the location reported by the device, is completely inside the geofence. Confidence will be medium when the user is mostly inside the geofence. Confidence will be low when the user is only partially inside the geofence.
The smaller the geofence and the less accurate the location reported by the device, the lower the confidence. You can create geofences as small as a 10 meter radius for circles and 1,000 square meters for polygons.
You may decide to ignore some events based on confidence levels.
When Geofence Stop Detection is on, Radar can understand the difference between a user walking or driving through a geofence and stopping in a geofence, and will only generate a geofence entry event when a user stops in a geofence (i.e., when
true based on tracking options or when
Turn on Geofence Stop Detection at a project level on the Settings page, under Geofences.
When Buffer Entries is on, Radar will use the accuracy of the location reported to determine overlap with the geofence boundary to generate a geofence entry event. See the confidence and accuracy for more on this detection logic. When off, the location reported will need to fall within the boundaries of the geofence to trigger the entry event.
When Buffer Exits is on, Radar will use the accuracy of the location reported as a buffering distance from geofence edge before generating a geofence exit event. This buffering minimizes premature exit detection. When off, the first location reported falling outside the boundaries of a geofence will trigger the exit event.