Class FenceGeotrigger


  • public class FenceGeotrigger
    extends Geotrigger
    A Geotrigger that defines regions or fences to be monitored using a GeotriggerMonitor.

    You can monitor areas of interest with a FenceGeotrigger, using spatial rules like enter or exit. This type of operation is also known as "Geofencing".

    Three main components comprise a FenceGeotrigger:

    • The GeotriggerFeed that is monitored for changes - usually the device location read from a LocationDataSource.
    • The FenceRuleType that describes the check that is performed with the feed and fence data - for example, "enters within 50 meters of".
    • The FenceParameters that the feed data are evaluated against. For example, a set of polygon features representing areas of interest. The FenceParameters can cover many features or graphics that are checked.
    A FenceGeotrigger can also take into account floors within buildings. If the feature table used to create the FeatureFenceParameters is referenced by a FeatureLayer that is FloorAware, and the LocationDataSource used to create the GeotriggerFeed includes LocationDataSource.Location.KEY_FLOOR information, then fences will only be entered when they are intersected by a LocationDataSource.Location on the correct floor. If the fence or location data does not include valid floor information, the floor is ignored and the fence is entered when it is intersected by the location.

    A floor aware feature layer or table must be part of a GeoModel that includes a valid GeoModelFloorDefinition. All layers and tables that are used by the floor definition are loaded when the GeotriggerMonitor is started.

    A Location can contain floor property as part of LocationDataSource.Location.getAdditionalSourceProperties(). This can be supplied as part of your own implementation.

    Since:
    100.12.0
    • Method Detail

      • getEnterExitSpatialRelationship

        public FenceEnterExitSpatialRelationship getEnterExitSpatialRelationship()
        Gets the spatial relationship that determines whether a fence polygon has been entered or exited.

        When determining whether a feed entity has entered or exited a fence polygon, there are two spatial operations that can be used:

        • Intersects, where the geometry of the feed must intersect the fence polygon.
        • Contains, where the geometry of the feed must be contained by the fence polygon.
        These operations can be used to determine whether a fence polygon has been entered, and also when it has been exited. Containment is a stricter version of intersection (e.g. when a fence contains a feed entity they also intersect) so will tend to result in fewer notifications when the two geometries are nearby. By using different combinations of these rules for enter and exit you can control the likelihood that notifications will be sent.

        Note that when the feed geometry is a Point there is no difference between intersection and containment so these options will not affect behavior. When using a LocationGeotriggerFeed, set getFeedAccuracyMode() to FenceGeotriggerFeedAccuracyMode.USE_GEOMETRY_WITH_ACCURACY in order to create a polygon geometry that accounts for the area of uncertainty around a LocationDataSource.Location.getPosition().

        The default value is FenceEnterExitSpatialRelationship.ENTER_INTERSECTS_AND_EXIT_DOES_NOT_INTERSECT.

        Returns:
        the spatial relationship that determines whether a fence polygon has been entered or exited
        Since:
        100.13.0
      • setEnterExitSpatialRelationship

        public void setEnterExitSpatialRelationship​(FenceEnterExitSpatialRelationship enterExitSpatialRelationship)
        Sets the spatial relationship that determines whether a fence polygon has been entered or exited.

        When determining whether a feed entity has entered or exited a fence polygon, there are two spatial operations that can be used:

        • Intersects, where the geometry of the feed must intersect the fence polygon.
        • Contains, where the geometry of the feed must be contained by the fence polygon.
        These operations can be used to determine whether a fence polygon has been entered, and also when it has been exited. Containment is a stricter version of intersection (e.g. when a fence contains a feed entity they also intersect) so will tend to result in fewer notifications when the two geometries are nearby. By using different combinations of these rules for enter and exit you can control the likelihood that notifications will be sent.

        Note that when the feed geometry is a Point there is no difference between intersection and containment so these options will not affect behavior. When using a LocationGeotriggerFeed, set getFeedAccuracyMode() to FenceGeotriggerFeedAccuracyMode.USE_GEOMETRY_WITH_ACCURACY in order to create a polygon geometry that accounts for the area of uncertainty around a LocationDataSource.Location.getPosition().

        The default value is FenceEnterExitSpatialRelationship.ENTER_INTERSECTS_AND_EXIT_DOES_NOT_INTERSECT.

        Parameters:
        enterExitSpatialRelationship - the spatial relationship that determines whether a fence polygon has been entered or exited
        Throws:
        IllegalArgumentException - if enterExitSpatialRelationship is null
        Since:
        100.13.0
      • getFeedAccuracyMode

        public FenceGeotriggerFeedAccuracyMode getFeedAccuracyMode()
        Describes how a FenceGeotrigger will use accuracy information from a GeotriggerFeed.

        This property controls how the accuracy information from a GeotriggerFeed is used to provide the Geometry for checking a Geotrigger condition. In particular, you can choose how to use the LocationDataSource.Location.getHorizontalAccuracy() property to reflect the uncertainty around a fixed LocationDataSource.Location.getPosition(). Due to factors including signal strength, GPS positions can be inaccurate, with a larger Location.getHorizontalAccuracy() representing a larger area where the device may actually be located. This can lead to spurious notifications when the Location.getPosition() is inaccurate and is incorrectly reported as inside or outside of a fence. By using the Location.getHorizontalAccuracy() you can choose to account for that wander in various ways.

        This property is used in conjunction with getEnterExitSpatialRelationship() to affect when notifications are sent.

        The default value is FenceGeotriggerFeedAccuracyMode.useGeometry.

        Note that you can also use an ArcadeExpression with the LocationGeotriggerFeed.getFilter() property to reject LocationDataSource.Location objects with a poor accuracy.

        Returns:
        describes how a FenceGeotrigger will use accuracy information from a GeotriggerFeed
        Since:
        100.13.0
      • setFeedAccuracyMode

        public void setFeedAccuracyMode​(FenceGeotriggerFeedAccuracyMode feedAccuracyMode)
        Describes how a FenceGeotrigger will use accuracy information from a GeotriggerFeed.

        This property controls how the accuracy information from a GeotriggerFeed is used to provide the Geometry for checking a Geotrigger condition. In particular, you can choose how to use the LocationDataSource.Location.getHorizontalAccuracy() property to reflect the uncertainty around a fixed LocationDataSource.Location.getPosition(). Due to factors including signal strength, GPS positions can be inaccurate, with a larger Location.getHorizontalAccuracy() representing a larger area where the device may actually be located. This can lead to spurious notifications when the Location.getPosition() is inaccurate and is incorrectly reported as inside or outside of a fence. By using the Location.getHorizontalAccuracy() you can choose to account for that wander in various ways.

        This property is used in conjunction with getEnterExitSpatialRelationship() to affect when notifications are sent.

        The default value is FenceGeotriggerFeedAccuracyMode.useGeometry.

        Note that you can also use an ArcadeExpression with the LocationGeotriggerFeed.getFilter() property to reject LocationDataSource.Location objects with a poor accuracy.

        Parameters:
        feedAccuracyMode - describes how a FenceGeotrigger will use accuracy information from a GeotriggerFeed
        Throws:
        IllegalArgumentException - if feedAccuracyMode is null
        Since:
        100.13.0
      • getRuleType

        public FenceRuleType getRuleType()
        Gets the FenceRuleType that describes the check performed with the feed and fence data.

        The rule controls the spatial query that will be used - for example "enter" or "exit".

        Returns:
        the FenceRuleType that describes the check performed with the feed and fence data
        Since:
        100.12.0
      • setRuleType

        public void setRuleType​(FenceRuleType ruleType)
        Sets the FenceRuleType that describes the check performed with the feed and fence data.

        The rule controls the spatial query that will be used - for example "enter" or "exit".

        Parameters:
        ruleType - the FenceRuleType that describes the check performed with the feed and fence data
        Throws:
        IllegalArgumentException - if ruleType is null
        Since:
        100.12.0