Geofencing is a concept in location aware apps that is used to determine if your current location is approaching, entering, dwelling, or leaving a point of interest (POI). For example, you may want to alert drivers of upcoming road closures, home buyers of newly available houses nearby, or tourists of an attraction they are approaching. This can be done with ease using ArcGIS Runtime's GeometryEngine. The GeometryEngine provides several static functions that allow you to ask questions about the spatial relationship of 2 or more geometries. For example, some questions you can ask are "does geometry 1 intersect geometry 2", "does geometry 1 completely contain geometry 2", and "how many meters is it from geometry 1 to geometry 2". The great thing about the GeometryEngine is that this works completely client side without any network connectivity, which means there is no internet usage, and thus limited battery consumption. By using the GeometryEngine, you can perform Geofencing with the following workflow:
connect(m_mapView->locationDisplay(), &LocationDisplay::locationChanged, this, [this](Location location)
{
Point currentLocation = GeometryEngine::project(location.position(), SpatialReference::webMercator());
...
m_within = GeometryEngine::intersects(currentLocation, m_graphic->geometry());
if (m_within)
alertUser("within");
A basic sample of this workflow can be found on GitHub. Give it a try, and see if you can enhance it to fit your organization's needs and use cases.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.