RadarGeofence represents a geofence. Learn more about Geofences.
Properties
The Radar ID of the geofence.
The description of the geofence. Not to be confused with the NSObject description property.
The external ID of the geofence.
The optional set of custom key-value pairs for the geofence.
geometry
RadarGeofenceGeometry
required
The geometry of the geofence, which can be cast to either RadarCircleGeometry or RadarPolygonGeometry.
The center of the circle geofence.
The radius of the circle geofence in meters.
Show RadarPolygonGeometry
The geometry of the polygon geofence. A closed ring of coordinates.
The calculated centroid of the polygon geofence.
The calculated radius of the polygon geofence in meters.
coordinate
CLLocationCoordinate2D
required
The coordinate.
The optional operating hours for the geofence.
hours
NSDictionary<NSString *, NSArray<NSArray<NSString *> *> *>
required
A dictionary mapping day names to arrays of time ranges. Each time range is an array of two strings representing the start and end times.
Methods
arrayForGeofences
+ (NSArray<NSDictionary *> *_Nullable)arrayForGeofences:(NSArray<RadarGeofence *> *_Nullable)geofences;
Converts an array of RadarGeofence objects to an array of dictionaries.
dictionaryValue
- (NSDictionary *_Nonnull)dictionaryValue;
Returns the dictionary representation of the geofence.
Example
let geofence: RadarGeofence = event.geofence
let geofenceId = geofence._id
let geofenceDescription = geofence.__description
let geofenceTag = geofence.tag
let geofenceExternalId = geofence.externalId
let geofenceMetadata = geofence.metadata
if let circleGeometry = geofence.geometry as? RadarCircleGeometry {
let center = circleGeometry.center
let radius = circleGeometry.radius
} else if let polygonGeometry = geofence.geometry as? RadarPolygonGeometry {
let center = polygonGeometry.center
let radius = polygonGeometry.radius
let coordinates = polygonGeometry._coordinates
}
RadarGeofence *geofence = event.geofence;
NSString *geofenceId = geofence._id;
NSString *geofenceDescription = geofence.__description;
NSString *geofenceTag = geofence.tag;
NSString *geofenceExternalId = geofence.externalId;
NSDictionary *geofenceMetadata = geofence.metadata;
if ([geofence.geometry isKindOfClass:[RadarCircleGeometry class]]) {
RadarCircleGeometry *circleGeometry = (RadarCircleGeometry *)geofence.geometry;
RadarCoordinate *center = circleGeometry.center;
double radius = circleGeometry.radius;
} else if ([geofence.geometry isKindOfClass:[RadarPolygonGeometry class]]) {
RadarPolygonGeometry *polygonGeometry = (RadarPolygonGeometry *)geofence.geometry;
RadarCoordinate *center = polygonGeometry.center;
double radius = polygonGeometry.radius;
NSArray<RadarCoordinate *> *coordinates = polygonGeometry._coordinates;
}