Skip to content

Commit

Permalink
Merge pull request #198 from Esri/Caleb/New-SetUpLocationDrivenGeotri…
Browse files Browse the repository at this point in the history
…gers

[New] Set up location-driven geotriggers
  • Loading branch information
CalebRas authored Jul 7, 2023
2 parents 9a53600 + e166fcc commit c92e82c
Show file tree
Hide file tree
Showing 6 changed files with 518 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Samples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,15 @@
D754E3242A1D66C20006C5F1 /* StylePointWithPictureMarkerSymbolsView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D754E3222A1D66820006C5F1 /* StylePointWithPictureMarkerSymbolsView.swift */; };
D7634FAF2A43B7AC00F8AEFB /* CreateConvexHullAroundGeometriesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7634FAE2A43B7AC00F8AEFB /* CreateConvexHullAroundGeometriesView.swift */; };
D7634FB02A43B8B000F8AEFB /* CreateConvexHullAroundGeometriesView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D7634FAE2A43B7AC00F8AEFB /* CreateConvexHullAroundGeometriesView.swift */; };
D769C2122A29019B00030F61 /* SetUpLocationDrivenGeotriggersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D769C2112A29019B00030F61 /* SetUpLocationDrivenGeotriggersView.swift */; };
D769C2132A29057200030F61 /* SetUpLocationDrivenGeotriggersView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D769C2112A29019B00030F61 /* SetUpLocationDrivenGeotriggersView.swift */; };
D77570C02A2942F800F490CD /* AnimateImagesWithImageOverlayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D77570BF2A2942F800F490CD /* AnimateImagesWithImageOverlayView.swift */; };
D77570C12A2943D900F490CD /* AnimateImagesWithImageOverlayView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D77570BF2A2942F800F490CD /* AnimateImagesWithImageOverlayView.swift */; };
D77572AE2A295DDE00F490CD /* PacificSouthWest2 in Resources */ = {isa = PBXBuildFile; fileRef = D77572AD2A295DDD00F490CD /* PacificSouthWest2 */; settings = {ASSET_TAGS = (AnimateImagesWithImageOverlay, ); }; };
D78666AD2A2161F100C60110 /* FindNearestVertexView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D78666AC2A2161F100C60110 /* FindNearestVertexView.swift */; };
D78666AE2A21629200C60110 /* FindNearestVertexView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D78666AC2A2161F100C60110 /* FindNearestVertexView.swift */; };
D79EE76E2A4CEA5D005A52AE /* SetUpLocationDrivenGeotriggersView.Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = D79EE76D2A4CEA5D005A52AE /* SetUpLocationDrivenGeotriggersView.Model.swift */; };
D79EE76F2A4CEA7F005A52AE /* SetUpLocationDrivenGeotriggersView.Model.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D79EE76D2A4CEA5D005A52AE /* SetUpLocationDrivenGeotriggersView.Model.swift */; };
D7ABA2F92A32579C0021822B /* MeasureDistanceInSceneView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7ABA2F82A32579C0021822B /* MeasureDistanceInSceneView.swift */; };
D7ABA2FA2A32760D0021822B /* MeasureDistanceInSceneView.swift in Copy Source Code Files */ = {isa = PBXBuildFile; fileRef = D7ABA2F82A32579C0021822B /* MeasureDistanceInSceneView.swift */; };
D7CC33FF2A31475C00198EDF /* ShowLineOfSightBetweenPointsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7CC33FD2A31475C00198EDF /* ShowLineOfSightBetweenPointsView.swift */; };
Expand Down Expand Up @@ -251,6 +255,8 @@
dstPath = "";
dstSubfolderSpec = 7;
files = (
D79EE76F2A4CEA7F005A52AE /* SetUpLocationDrivenGeotriggersView.Model.swift in Copy Source Code Files */,
D769C2132A29057200030F61 /* SetUpLocationDrivenGeotriggersView.swift in Copy Source Code Files */,
D752D9412A39162F003EB25E /* ManageOperationalLayersView.swift in Copy Source Code Files */,
D77570C12A2943D900F490CD /* AnimateImagesWithImageOverlayView.swift in Copy Source Code Files */,
D7634FB02A43B8B000F8AEFB /* CreateConvexHullAroundGeometriesView.swift in Copy Source Code Files */,
Expand Down Expand Up @@ -413,9 +419,11 @@
D75362D12A1E886700D83028 /* ApplyUniqueValueRendererView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApplyUniqueValueRendererView.swift; sourceTree = "<group>"; };
D754E3222A1D66820006C5F1 /* StylePointWithPictureMarkerSymbolsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StylePointWithPictureMarkerSymbolsView.swift; sourceTree = "<group>"; };
D7634FAE2A43B7AC00F8AEFB /* CreateConvexHullAroundGeometriesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateConvexHullAroundGeometriesView.swift; sourceTree = "<group>"; };
D769C2112A29019B00030F61 /* SetUpLocationDrivenGeotriggersView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SetUpLocationDrivenGeotriggersView.swift; sourceTree = "<group>"; };
D77570BF2A2942F800F490CD /* AnimateImagesWithImageOverlayView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimateImagesWithImageOverlayView.swift; sourceTree = "<group>"; };
D77572AD2A295DDD00F490CD /* PacificSouthWest2 */ = {isa = PBXFileReference; lastKnownFileType = folder; path = PacificSouthWest2; sourceTree = "<group>"; };
D78666AC2A2161F100C60110 /* FindNearestVertexView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FindNearestVertexView.swift; sourceTree = "<group>"; };
D79EE76D2A4CEA5D005A52AE /* SetUpLocationDrivenGeotriggersView.Model.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SetUpLocationDrivenGeotriggersView.Model.swift; sourceTree = "<group>"; };
D7ABA2F82A32579C0021822B /* MeasureDistanceInSceneView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeasureDistanceInSceneView.swift; sourceTree = "<group>"; };
D7CC33FD2A31475C00198EDF /* ShowLineOfSightBetweenPointsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShowLineOfSightBetweenPointsView.swift; sourceTree = "<group>"; };
D7E440D62A1ECE7D005D74DE /* CreateBuffersAroundPointsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateBuffersAroundPointsView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -583,6 +591,7 @@
D734FA072A183A5A00246D7E /* Set max extent */,
D7EAF34F2A1C011000D822C4 /* Set min and max scale */,
E088E1552862578800413100 /* Set surface placement mode */,
D769C20D2A28FF8600030F61 /* Set up location-driven geotriggers */,
E004A6B928414332002A1FE6 /* Set viewpoint rotation */,
1C43BC782A43781100509BF8 /* Set visibility of subtype sublayer */,
E004A6DE2846626A002A1FE6 /* Show callout */,
Expand Down Expand Up @@ -982,6 +991,15 @@
path = "Style point with picture marker symbols";
sourceTree = "<group>";
};
D769C20D2A28FF8600030F61 /* Set up location-driven geotriggers */ = {
isa = PBXGroup;
children = (
D769C2112A29019B00030F61 /* SetUpLocationDrivenGeotriggersView.swift */,
D79EE76D2A4CEA5D005A52AE /* SetUpLocationDrivenGeotriggersView.Model.swift */,
);
path = "Set up location-driven geotriggers";
sourceTree = "<group>";
};
D77570BC2A29427200F490CD /* Animate images with image overlay */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1475,6 +1493,7 @@
0005580A2817C51E00224BC6 /* SampleDetailView.swift in Sources */,
4D2ADC6229C5071C003B367F /* ChangeMapViewBackgroundView.Model.swift in Sources */,
0074ABCD2817BCC30037244A /* SamplesApp+Samples.swift.tache in Sources */,
D79EE76E2A4CEA5D005A52AE /* SetUpLocationDrivenGeotriggersView.Model.swift in Sources */,
E004A6F3284E4FEB002A1FE6 /* ShowResultOfSpatialOperationsView.swift in Sources */,
D751018E2A2E962D00B8FA48 /* IdentifyLayerFeaturesView.swift in Sources */,
F1E71BF1289473760064C33F /* AddRasterFromFileView.swift in Sources */,
Expand All @@ -1486,6 +1505,7 @@
E066DD3B2860CA08004D3D5B /* ShowResultOfSpatialRelationshipsView.swift in Sources */,
7573E81E29D6134C00BEED9C /* TraceUtilityNetworkView.Views.swift in Sources */,
4D2ADC5A29C4F612003B367F /* ChangeMapViewBackgroundView.swift in Sources */,
D769C2122A29019B00030F61 /* SetUpLocationDrivenGeotriggersView.swift in Sources */,
79302F852A1ED4E30002336A /* CreateAndSaveKMLView.Model.swift in Sources */,
0044CDDF2995C39E004618CE /* ShowDeviceLocationHistoryView.swift in Sources */,
E041ABC0287CA9F00056009B /* WebView.swift in Sources */,
Expand Down
46 changes: 46 additions & 0 deletions Shared/Samples/Set up location-driven geotriggers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Set up location-driven geotriggers

Create a notification every time a given location data source has entered and/or exited a set of features or graphics.

![Image of Set up location-driven geotriggers sample](set-up-location-driven-geotriggers.png)

## Use case

Geotriggers can be used to notify users when they have entered or exited a geofence by monitoring a given set of features or graphics. They could be used to display contextual information to museum visitors about nearby exhibits, notify hikers when they have wandered off their desired trail, notify dispatchers when service workers arrive at a scene, or more.

## How to use the sample

Observe a virtual walking tour of the Santa Barbara Botanic Garden. Information about the user's current Garden Section, as well as information about nearby points of interest within 10 meters will display or be removed from the UI when the user enters or exits the buffer of each feature.

## How it works

1. Create a `GeotriggerFeed` with a `LocationDataSource` object (in this case, a `SimulatedLocationDataSource`).
2. Create a `FeatureFenceParameters` class from a `ServiceFeatureTable`, a buffer distance at which to monitor each feature, an Arcade Expression, and a name for the specific geotrigger.
3. Create a `FenceGeotrigger` with the geotrigger feed, a `FenceGeotrigger.RuleType`, and the fence parameters.
4. Create a `GeotriggerMonitor` with the fence geotrigger and call `GeotriggerMonitor.start()` to begin listening for events that meet the fence rule type.
5. When the `notifications` emit, capture the `GeotriggerNotificationInfo`.
6. For more information about the feature that triggered the notification, cast the `GeotriggerNotificationInfo` to a `FenceGeotriggerNotificationInfo` and call `FenceGeotriggerNotificationInfo.fenceGeoElement`.
7. Depending on the `FenceGeotriggerNotificationInfo.fenceNotificationType` display or hide information on the UI from the `GeoElement`'s attributes.

## Relevant API

* ArcadeExpression
* FeatureFenceParameters
* FenceGeotrigger
* FenceGeotrigger.RuleType
* FenceGeotriggerNotificationInfo
* GeoElement
* Geotrigger
* GeotriggerFeed
* GeotriggerMonitor
* GeotriggerNotificationInfo
* ServiceFeatureTable
* SimulatedLocationDataSource

## About the data

This sample uses the [Santa Barbara Botanic Garden Geotriggers Sample](https://www.arcgis.com/home/item.html?id=6ab0e91dc39e478cae4f408e1a36a308) ArcGIS Online Web Map which includes a georeferenced map of the garden as well as select polygon and point features to denote garden sections and points of interest. Description text and attachment images in the feature layers were provided by the Santa Barbara Botanic Garden and more information can be found on the [Garden Sections & Displays](https://www.sbbg.org/explore-garden/garden-sections-displays) portion of their website. All assets are used with permission from the Santa Barbara Botanic Garden. For more information, visit the [Santa Barbara Botanic Garden](https://www.sbbg.org) website.

## Tags

alert, arcade, fence, geofence, geotrigger, location, navigation, notification, notify, routing, trigger
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"category": "Display information",
"description": "Create a notification every time a given location data source has entered and/or exited a set of features or graphics.",
"ignore": false,
"images": [
"set-up-location-driven-geotriggers.png"
],
"keywords": [
"alert",
"arcade",
"fence",
"geofence",
"geotrigger",
"location",
"navigation",
"notification",
"notify",
"routing",
"trigger",
"ArcadeExpression",
"FeatureFenceParameters",
"FenceGeotrigger",
"FenceGeotrigger.RuleType",
"FenceGeotriggerNotificationInfo",
"GeoElement",
"Geotrigger",
"GeotriggerFeed",
"GeotriggerMonitor",
"GeotriggerNotificationInfo",
"ServiceFeatureTable",
"SimulatedLocationDataSource"
],
"redirect_from": [],
"relevant_apis": [
"ArcadeExpression",
"FeatureFenceParameters",
"FenceGeotrigger",
"FenceGeotrigger.RuleType",
"FenceGeotriggerNotificationInfo",
"GeoElement",
"Geotrigger",
"GeotriggerFeed",
"GeotriggerMonitor",
"GeotriggerNotificationInfo",
"ServiceFeatureTable",
"SimulatedLocationDataSource"
],
"snippets": [
"SetUpLocationDrivenGeotriggersView.swift",
"SetUpLocationDrivenGeotriggersView.Model.swift"
],
"title": "Set up location-driven geotriggers"
}
Loading

0 comments on commit c92e82c

Please sign in to comment.