Introduction
ArcGIS Velocityis an ArcGIS Online extension that enables real-time and big data analytics, and is offered as SaaS (Software-as-a-Service). Amazon Web Services (AWS), meanwhile, provides managed and serverless services that support real-time data processing. By combining these services, you can scale processing as needed while reducing the burden of server management.
In this article, we’ll combine services provided by ArcGIS Velocity and AWS to build a system that aggregates and visualizes real-time location data by road name. We’ll cover the setup in two installments: Part 1 and Part 2.
Part 1 covers ingesting moving asset data with AWS IoT Core, snapping it to a road network using ArcGIS Velocity, and connecting it to external processing through Amazon MSK. Part 2 covers aggregating the data by road name with custom processing on Amazon ECS Fargate and visualizing it in real time with ArcGIS Online.
Overview of the prototype processing platform
For this setup, we use AWS IoT Core to ingest moving asset data and provide the entry point for real-time data transfer to ArcGIS Velocity. We also run custom processing on Amazon ECS Fargate to count moving assets by road, connecting it to ArcGIS Velocity through Amazon MSK.
With this configuration, moving assets’ location data is corrected to align with the road network, aggregated by road name, and visualized in real time according to the number of moving assets on each road.
For real-time analytics in ArcGIS Velocity, we configured the following. For the incoming moving asset data, we applied a map-matching process to the road data (Snap to Network) and configured connections to each AWS service.
The following is an example of the visualization produced by the processing platform we built. The road line symbols and labels change dynamically according to the real-time number of moving assets on each road. Part 2 covers in more detail how to create a stream layer from the aggregation results and configure its visualization on a map.
Now, let’s review the setup step by step.
AWS IoT Core
We use AWS IoT Core as the infrastructure for receiving location data sent by moving assets. AWS IoT Core is a managed service that enables two-way communication with devices using the MQTT protocol, making it possible to reliably ingest large volumes of data in real time.
First, check the endpoint for connecting to AWS IoT Core. Get the data communication endpoint from the domain configuration page in the IoT Core section of the AWS Management Console.
Next, prepare credentials for connecting ArcGIS Velocity to IoT Core. In this article, we use IAM authentication (Access Key / Secret Access Key). To do this, create an IAM user with a policy that allows connections to IoT Core and message reception, then issue access keys. The policy must include at least the following three permissions:
- iot:Connect (allow connections)
- iot:Subscribe (subscribe to topic filters)
- iot:Receive (receive messages)
Next, create a feed in ArcGIS Velocity to ingest moving asset data from AWS IoT Core. For the feed type, select “AWS IoT” and enter the IAM authentication credentials created earlier. We assume that moving assets with unique device IDs send messages in JSON format to topics named by device, such as demo/vehicles/{deviceId}. In ArcGIS Velocity, we specify demo/vehicles/+ using the single-level wildcard (+). This allows messages from multiple devices to be received together.
From the JSON data sent by the moving assets, specify fields for location (longitude and latitude), date, and Track ID (unique device ID), among others.
This completes the configuration for ingesting data into ArcGIS Velocity using AWS IoT Core.
ArcGIS Velocity real-time analytics: Snap to Network
Using [Snap to Network], a feature provided by ArcGIS Velocity real-time analytics, you can snap incoming moving asset locations (longitude and latitude) to the lines of a specified road network in real time.
In the real-time analytics interface, add [Snap to Network] from the node menu, then connect the moving asset data to any road network in feature layer format. For the road network, we used ESRI Japan Data Content ArcGIS Geo Suite Road Network with Vehicle-Specific Restrictions . Note that the F_AUTOMOBI / T_AUTOMOBI fields must be added to the road network in advance so that “Snap to Network” can detect one-way road restrictions.
Next, set the parameter values for [Snap to Network]. For the Track ID field, specify the field containing the unique device ID. If the moving asset data includes a heading (direction of travel) field, specifying it can improve the snapping results. For the join fields, specify the road network fields to attach to the snapped moving assets. Since we need to aggregate by road name in a later step, we specify the name field, which contains the road names.
For details about each parameter and the values used to define the F_AUTOMOBI / T_AUTOMOBI fields added to the road network, see the ArcGIS Velocity Help page.
This completes the configuration for snapping the incoming moving asset locations (longitude and latitude) to the road network in real time.
Amazon MSK
Next, we set up Amazon MSK as the streaming platform for sending moving asset data snapped to the road network in ArcGIS Velocity to external processing.
Amazon MSK (Amazon Managed Streaming for Apache Kafka) is a service that lets you use Apache Kafka as a managed service on AWS. In Kafka, topics serve as destinations and sources for data: producers send messages to topics, and consumers subscribe to topics and process the messages.
In this configuration, ArcGIS Velocity outputs the snapped moving asset data to an Amazon MSK topic, which is read by custom processing running on Amazon ECS. The custom processing then outputs its road-name aggregation results to a separate topic, which ArcGIS Velocity ingests again.
We created the following two Kafka topics:
Topic name | Purpose |
velocity-snapped-vehicles | Moving asset data output from ArcGIS Velocity, snapped to the road network |
velocity-name-counts | Road-name aggregation results output by custom processing on Amazon ECS |
After creating a cluster in Amazon MSK, check the bootstrap servers that Kafka clients will use to connect. When connecting from ArcGIS Velocity, you must specify a public endpoint that Velocity can reach.
For authentication when connecting from ArcGIS Velocity to Kafka, we use SASL/SCRAM . SASL/SCRAM is an authentication method in which Kafka clients use a username and password to connect to brokers. Unlike sending a password in plain text, this method does not transmit the password itself over the network, making authentication more secure. To use SASL/SCRAM authentication with Amazon MSK, register the username and password used for the connection in AWS Secrets Manager, then associate the secret with the MSK cluster. The secret is encrypted using an AWS Key Management Service (AWS KMS) customer-managed key. Therefore, for this test, we created an AWS KMS key in advance and used it to save the SASL/SCRAM credentials in Secrets Manager.
By associating the created secret with the MSK cluster, the cluster can authenticate Kafka clients (ArcGIS Velocity) when they connect.
In addition, which topics users defined with SASL/SCRAM authentication can read from or write to is controlled by configuring Kafka ACLs (access control lists). ACLs are configured using the Kafka client tool kafka-acls.sh from a client environment that can connect to Amazon MSK.
Next, add a Kafka output to the real-time analysis in ArcGIS Velocity. Connect the result of snapping to the road network to the Kafka output node. For the Broker, specify the public endpoint of the bootstrap server you checked earlier, and set velocity-snapped-vehicles as the destination topic. Also select SASL/SCRAM as the authentication method and configure the username and password.
This completes the configuration to send moving-object data snapped to the road network in ArcGIS Velocity to Amazon MSK in real time.
Summary
In this first part, we introduced how to build a real-time processing platform by combining ArcGIS Velocity with AWS services, covering everything from ingesting moving-object data and snapping it to a road network to integrating the data with Amazon MSK.
By integrating AWS IoT Core with ArcGIS Velocity, we built a system that corrects the positions of moving objects acquired in real time to align with the road network, then sends the results to external processing systems through Amazon MSK.
In the next, second part, we will process the moving-object data sent to Amazon MSK using a Python program running on Amazon ECS Fargate and aggregate the number of vehicles by road name. We will also show how to import the aggregated results into ArcGIS Velocity and visualize them in real time using ArcGIS Online Map Viewer.
Related links
- ArcGIS
- Amazon Web Services