Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New] Set up location-driven geotriggers #198

Merged
merged 39 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
f74a948
Add ReadME
CalebRas Jun 1, 2023
ed8d9c4
Add view file
CalebRas Jun 1, 2023
c5dbc62
Add metadata
CalebRas Jun 1, 2023
0259e1e
Add source file to Build Phases
CalebRas Jun 1, 2023
be83b68
Add map
CalebRas Jun 1, 2023
6e68a0d
Add map data
CalebRas Jun 1, 2023
6b0eb4c
Add toolbar
CalebRas Jun 1, 2023
de90ca2
Update error handling.
CalebRas Jun 2, 2023
8272924
Add view model.
CalebRas Jun 6, 2023
31eb484
Update comments.
CalebRas Jun 7, 2023
f4032cc
Add screenshot.
CalebRas Jun 7, 2023
7130a2b
Update source.
CalebRas Jun 7, 2023
665bb3f
Update source file.
CalebRas Jun 9, 2023
3654a06
Update Shared/Samples/Set up location-driven geotriggers/SetUpLocatio…
CalebRas Jun 15, 2023
ef9a58f
Update Shared/Samples/Set up location-driven geotriggers/SetUpLocatio…
CalebRas Jun 15, 2023
65d75af
Update with review suggestions.
CalebRas Jun 15, 2023
b3f0b27
Update Shared/Samples/Set up location-driven geotriggers/README.md
CalebRas Jun 15, 2023
ababc90
Merge branch 'v.next' into Caleb/New-SetUpLocationDrivenGeotrigers
CalebRas Jun 15, 2023
eef296a
Update ReadME.
CalebRas Jun 15, 2023
2ca9047
Merge remote-tracking branch 'refs/remotes/origin/Caleb/New-SetUpLoca…
CalebRas Jun 15, 2023
4b152e1
Merge branch 'v.next' into Caleb/New-SetUpLocationDrivenGeotrigers
CalebRas Jun 15, 2023
bcd7513
Merge branch 'v.next' into Caleb/New-SetUpLocationDrivenGeotrigers
CalebRas Jun 15, 2023
f41a25b
Update Shared/Samples/Set up location-driven geotriggers/SetUpLocatio…
CalebRas Jun 16, 2023
34eb6ec
Update Shared/Samples/Set up location-driven geotriggers/SetUpLocatio…
CalebRas Jun 16, 2023
63311ea
Update with review suggestions.
CalebRas Jun 16, 2023
d0f40b4
Update swift concurrency.
CalebRas Jun 21, 2023
682ad43
Merge branch 'v.next' into Caleb/New-SetUpLocationDrivenGeotrigers
CalebRas Jun 21, 2023
a5cbcd6
Merge branch 'v.next' into Caleb/New-SetUpLocationDrivenGeotrigers
CalebRas Jun 22, 2023
3e9bf10
Merge branch 'v.next' into Caleb/New-SetUpLocationDrivenGeotrigers
CalebRas Jun 23, 2023
9db694f
Merge branch 'v.next' into Caleb/New-SetUpLocationDrivenGeotrigers
CalebRas Jun 23, 2023
e2e98c3
Add view model file.
CalebRas Jun 28, 2023
26663a4
Update metadata.
CalebRas Jun 28, 2023
3c6aad8
Update metadata.
CalebRas Jun 28, 2023
af36099
Apply suggestions from code review.
CalebRas Jun 28, 2023
2490c1d
Apply review suggestions.
CalebRas Jul 3, 2023
bdffdad
Update Shared/Samples/Set up location-driven geotriggers/README.md
CalebRas Jul 3, 2023
e21d313
Merge branch 'v.next' into Caleb/New-SetUpLocationDrivenGeotrigers
CalebRas Jul 3, 2023
632b857
Sort after conflict merge.
CalebRas Jul 3, 2023
e166fcc
Merge branch 'v.next' into Caleb/New-SetUpLocationDrivenGeotrigers
CalebRas Jul 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Samples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,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 @@ -245,6 +249,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 @@ -401,9 +407,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 @@ -571,6 +579,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 */,
E004A6DE2846626A002A1FE6 /* Show callout */,
D7EF5D712A269E2D00FEBDE5 /* Show coordinates in multiple formats */,
Expand Down Expand Up @@ -959,6 +968,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 @@ -1449,6 +1467,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 @@ -1460,6 +1479,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