Select to view content in your preferred language

How to maintain beacon data for ArcGIS IPS

1475
0
04-27-2023 11:43 AM
Labels (2)
Tejeshwar_Sharma
Esri Contributor
1 0 1,475

Maintaining up-to-date beacon data in your IPS model ensures that the performance of an ArcGIS IPS deployment is not affected by misconfigured, missing, or non-operational beacons. The status and health of the beacons should be monitored periodically. Managing beacon data can be broken down into the following parts:

  • Creating the beacon placement plan
  • Collecting beacon data
  • Updating beacon data
  • Visualizing data in ArcGIS Pro
  • Creating dashboards to monitor IPS deployment

Note: This post describes the workflow for Kontakt.io beacons. It can also be applied to other Bluetooth Low Energy (BLE) beacons that support the iBeacon protocol and can be configured using similar steps.

Create the beacon placement plan

The Beacons feature class is part of the ArcGIS IPS core model and is used for creating a beacon placement plan and maintaining the beacon data. You can create the beacon placement plan in ArcGIS Pro by placing points in the Beacons feature class. Once the beacon placement plan is drafted, you can add the Beacons layer to a local IPS map in ArcGIS Pro. The IPS map can then be published as a web map on an ArcGIS Online or ArcGIS Enterprise portal.

Beacons layer to be added to an IPS map in ArcGIS ProBeacons layer to be added to an IPS map in ArcGIS Pro

Deploy the beacons

When deploying beacons, follow the beacon placement plan in the ArcGIS Field Maps mobile app. The Beacons layer must be visible on the map and the beacon settings must be configured correctly for a successful deployment.

Start by identifying the point features. These represent locations where beacons are being deployed. Tap each point and enter the corresponding ID in the Beacon ID field. You can find the ID on the back of the casing or on an ID sticker attached to the beacon. Note that these IDs are case-sensitive. Incorrect IDs will lead to data issues later.

Beacon ID field in Field MapsBeacon ID field in Field Maps

To approve the changes, tap the check mark on the Field Maps app screen. After updating the beacon IDs, you can open the web map in ArcGIS Pro to verify that the Beacons feature class contains the beacon IDs.

Updated Beacon ID in ArcGIS ProUpdated Beacon ID in ArcGIS Pro

Learn more about ArcGIS Field Maps

Collect beacon data

Once the beacons are deployed, it is a good practice to perform beacon data collection regularly. This will help you gain an overview of your deployment and achieve the best end-user experience. Collecting battery level information for beacons can help identify future maintenance needs and ensures that the latest data is available in the Beacons feature class.

To collect beacon data, you will need to be in the facility where IPS is deployed and use the Kio Setup Manager app, which is used for the installation, configuration, and monitoring of Kontakt.io beacons. Before attempting data collection, make sure you have granted Bluetooth and Location permissions for the app on the device you are using. Then you can follow these steps for data collection:

1. Sign in with your Kontakt.io credentials, tap My Devices, and swipe down to synchronize the data. (You must have a stable internet connection for a full sync, and depending on the number of beacons, it may take 10 minutes or more.)
Synchronize Beacon DataSynchronize Beacon Data

2. Once the synchronization is complete, scan all your BLE beacons.

3. Once all beacons are scanned, sign in to your Kontakt.io Kio Cloud account. The Launchpad screen is displayed when you first sign in.

4. Click Device Management to view a list of all beacons.

5. From the Beacons page, select all the beacons that data was collected for and click Export selected (number) as CSV. You will be taken to another page where you can download the exported .csv file.

Update data in the IPS model

Now that you have updated the beacons data, you will need to add it to the IPS model. There are several ways to import the .csv file into the Beacons feature class: You can use the Append tool in ArcGIS Pro or run a Python script.

Update with the Append tool

To use the Append tool, begin by opening the Beacons feature layer of your web map in ArcGIS Pro. You can find the Append tool in the Geoprocessing pane. You will use the exported .csv file as the input dataset and the Beacons layer as the target dataset. Set the rest of the tool parameters as follows:

  • Field Matching Type—Use the field map to reconcile field differences.
  • Field Map—Match the output fields with the source. For example, Choose the Battery_Level as an output field and select the batteryLevel field from the .csv file as a Source.

Under Update Options:

  • Target Fields—Beacon ID
  • Input Fields—uniqueId (this column may have a different name in your .csv file)

Enable undo and run the tool. Review the data in the Beacons attribute table.

Update data with Append toolUpdate data with Append tool

Note: Precise labeling during installation ensures that the Beacons attribute table is successfully populated. If there are mismatched and incorrect Beacon IDs after running the tool, the labels must be corrected manually. After making any necessary fixes, rerun the Append tool to populate the missing attributes.

Update with Python

Alternatively, you can use Python to update the feature class. Here is a sample script, which may require modifications depending on the structure of your .csv file:

 

import arcpy
import csv

arcpy.env.workspace = r"C:\ArcGIS\Projects\DemoProject\DemoProject.gdb"

csv_file = r"C:\Users\myUser\beacons.csv"

fc = "Beacons"

battery_per_beacon = {}
power_level_per_beacon = {}
with open(csv_file, 'r') as f:
    heading = next(f)
    reader = csv.reader(f, delimiter=';')
    for row in reader:
        power_level_per_beacon[row[0]] = row[12]
        battery_per_beacon[row[0]] = row[48]

not_in_fc = []
not_in_csv = []

with arcpy.da.UpdateCursor(fc, ["LABEL", 'TX_POWER', "BATTERY_LEVEL"]) as cursor:
    for row in cursor:
        if row[0] in battery_per_beacon and row[0] in power_level_per_beacon:
            row[1] = power_level_per_beacon[row[0]]
            row[2] = battery_per_beacon[row[0]]
            cursor.updateRow(row)
            power_level_per_beacon.pop(row[0])
        else:
            not_in_csv.append(row[0])

not_in_fc = list(power_level_per_beacon.keys())

print("Values not found in feature class:", not_in_fc, "\n", "Values not found in csv file:", not_in_csv)

 

 

To update the IPS model, do the following:

1. Import necessary modules.

 

import arcpy
import csv​

 

 

2. Set the workspace for the feature class.

 

arcpy.env.workspace = r"C:\ArcGIS\Projects\DemoProject\DemoProject.gdb"​

 

 

3. Set the path to the .csv file that contains the updated beacons attribute values.

 

csv_file = r"C:\Users\myUser\beacons.csv"​

 

 

4. Create a variable with the name of the Beacons feature class.

 

fc = "Beacons"​

 

 

5. Create Python dictionaries to match the Beacons feature class field names with the column labels in the .csv file. The matching key is the Beacon ID, which should be found both in the feature class and the .csv file. In the following example, we get the up-to-date values for Battery level (column 12) and Power level (column 48) from beacons.csv.

 

battery_per_beacon = {}
power_level_per_beacon = {}
with open(csv_file, 'r') as f:
    heading = next(f)
    reader = csv.reader(f, delimiter=';')
    for row in reader:
        power_level_per_beacon[row[0]] = row[12]
        battery_per_beacon[row[0]] = row[48]​

 

 

6. Create Python lists to store the missing values. In a perfect match, these lists should be empty after running the script. If they are not, it means that some keys could not be matched.

 

not_in_fc = []
not_in_csv = []​

 

 

7. Use an update cursor to iterate through the feature class and update the values. In addition, some print statements are implemented, to verify that every value was successfully updated.

 

# use an update cursor to iterate through the feature class 
with arcpy.da.UpdateCursor(fc, ["LABEL", 'TX_POWER', "BATTERY_LEVEL"]) as cursor:
    for row in cursor:
        # check if the Label value is in the csv_dict
        if row[0] in battery_per_beacon and row[0] in power_level_per_beacon:
            # update the TX_POWER Field
            row[1] = power_level_per_beacon[row[0]]
            # update the BATTERY_LEVEL Field
            row[2] = battery_per_beacon[row[0]]
            cursor.updateRow(row)
            # remove the Beacon Label from the dictionaries to keep track of the values that were not updated
            power_level_per_beacon.pop(row[0])
        else:
            # add the Label value to the not_in_csv list
            not_in_csv.append(row[0])

# add the remaining unique id values in the csv_dict to the not_in_fc list
not_in_fc = list(power_level_per_beacon.keys())

# print the lists with the missing values
print("Values not found in feature class:", not_in_fc, "\n")
print("Values not found in csv file:", not_in_csv)​

 

 

8. If the lists not_in_fc and not_in_csv both contain values, it means that some keys could not be matched. This can happen if beacons.csv contains data about beacons that have not been deployed, or if beacon IDs were not entered correctly during the deployment. Comparing the two lists will help you identify mismatches. If beacon IDs are incorrect, you can fix them in the feature class and rerun the script.

Visualize data in ArcGIS Pro

Once the Beacons feature class attribute values are updated, you can visualize their status in ArcGIS Pro by completing the following steps:

1. Right-click the Beacons feature class in the Contents pane and select Labeling Properties. The Label Class – Beacons pane is displayed.

2. Select the Battery Level from the Fields list. By selecting any field name, an expression is applied that visualizes the corresponding values as labels.

3. Optionally, under the Symbol tab, set up the appearance of the label.

4. Save the changes.

Visualize data in ArcGIS ProVisualize data in ArcGIS Pro

Create dashboards

Dashboards can help with effective maintenance management and decision-making. The following steps explain how to create a dashboard from your maintenance map to monitor the state of deployment and view the battery status of the deployed beacons.

1. Open your map overview in ArcGIS Online or the ArcGIS Enterprise portal.

2. Click Create Web App, and from the drop-down list, choose Dashboards.

3. Add a title, optional tags, and an optional summary. Click Create dashboard when finished.

4. Add elements by using the Add + button. For example: Add a list with all the beacons on a selected floor where you visualize the LABEL and the BATTERY_LEVEL together:

a. Add an element and choose the List.

b. Select the Beacons layer.

c. Under the Data tab, filter by LEVEL ID to display beacons from one floor.

Data tab of dashboard creationData tab of dashboard creation

d. Under the List tab, change the Line item template to {BEACON_ID} - {BATTERY_LEVEL}.

List tab of dashboard creationList tab of dashboard creation

e. Under the General tab, customize the general settings.

f. Under the Actions tab, turn on the Flash and Show pop-up toggle buttons.

Actions tab of dashboard creationActions tab of dashboard creation

g. Click Done.

5. Click the Layout button, switch to the Header tab, and select Add Header. Fill in the necessary fields and click Done.

6. In the Layout window, choose the Header tab, and click Add Selector. Define the floor data that needs to be shown for each layer:

a. Choose Category selector. In the Value columns, enter the level IDs for each floor and a display name.

b. Under Actions, filter all your targets:

  • Beacons
  • IPS_Recordings
  • Pathways
  • Details
  • Units
  • Levels

c. Specify the Level ID option for the Target Field and click Done.

7. Click the Theme button and change the theme based on your needs. Save your dashboard.

Saved dashboardSaved dashboard

Over time, you may want to update your beacon plan, either by adding more beacons or changing their location. Maintaining your beacon data will help that process go smoothly and ensure that your IPS model is accurate.