The arcgis.realtime module provides API functions to work with and automate real-time data feeds, continuous processing and analysis of streaming data, and stream layers.
This module contains the following:
StreamLayer
provides types and functions for receiving real-time data feeds and sensor data streamed from the GIS to perform continuous processing and analysis. It includes support for stream layers that allow Python scripts to subscribe to the streamed feature data or broadcast updates or alerts.The
Velocity
class and the various submodules provide API functions to automate the ArcGIS Velocity REST API.
StreamLayer
- class arcgis.realtime.StreamLayer(url, gis=None)
Allows Python scripts to subscribe to the feature data streamed from the GIS, using ArcGIS GeoEvent Server or ArcGIS Velocity, or to broadcast updates and alerts. This class can be used to perform continuous processing and analysis on streaming data as it is received.
- property filter
Get/Set property used for filtering the streamed features so they meet spatial and SQL like criteria, and return the specified fields.
- subscribe(on_features, on_open=None, on_disconnect=None, on_error=None)
Allows Python scripts to subscribe to the feature data streamed from the GIS using ArcGIS GeoEvent Server or ArcGIS Velocity. Subscribing to the streamed data can be used to perform continuous processing and analysis of real-time data as it is received.
Parameter
Description
on_features
callback function that is called every time features are streamed to the client.
on_open
callback function called when the connection to the streaming server is created.
on_disconnect
callback function called when the connection to the streaming server is closed.
on_error
callback function called if the connection recieves an error.
Velocity
- class arcgis.realtime.Velocity(url, gis)
Provides access to real-time analytics, big data analytics, and feeds in ArcGIS Velocity.
Parameter
Description
url
URL of the ArcGIS Velocity organization.
gis
an authenticated
arcigs.gis.GIS
object.# Connect to a Velocity instance: gis = GIS(url="url",username="username",password="password",) velocity = gis.velocity velocity
# UsageExample: from arcgis.gis import GIS gis = GIS(url="url",username="username",password="password",) velocity = gis.velocity velocity
- property bigdata_analytics
Provides access to the resource manager for managing configured big data analytic tasks in ArcGIS Velocity.
- Returns:
# Get instance of bigdata_analytics from `velocity`: bigdata_analytics = velocity.bigdata_analytics bigdata_analytics
- property feeds
Provides access to the resource manager for managing configured feeds in ArcGIS Velocity.
- Returns:
# Get instance of feeds from `velocity`: feeds = velocity.feeds feeds
FeedsManager
- class arcgis.realtime.velocity.FeedsManager(url, gis)
Used to manage a feed item.
Parameter
Description
url
URL of the ArcGIS Velocity organization.
gis
An authenticated
GIS
object.- create(feed=None)
Creates a new feed configuration.
Parameter
Description
feed
An instance of a feed such as RSS or HTTP Poller.
- Returns:
Id and label of the newly created feed
# Usage Example of creating a feature layer feed # Connect to a Velocity instance from arcgis import GIS from arcgis.realtime.velocity.feeds_manager import Feed gis = GIS( url="https://url.link", username="user_name", password="user_password", ) velocity = gis.velocity feeds = gis.velocity.feeds feeds # Configure the Feature Layer Feed from arcgis.realtime.velocity.feeds import FeatureLayer from arcgis.realtime.velocity.http_authentication_type import ( NoAuth, BasicAuth, CertificateAuth, ) from arcgis.realtime.velocity.input.format import DelimitedFormat from arcgis.realtime.velocity.feeds.geometry import XYZGeometry, SingleFieldGeometry from arcgis.realtime.velocity.feeds.time import TimeInterval, TimeInstant from arcgis.realtime.velocity.feeds.run_interval import RunInterval # feature layer properties name = "feature_layer_name" description = "feature_layer_description" url = "feature_layer_url" extent = { "spatialReference": { "latestWkid": 3857, "wkid": 102100 }, "xmin": "xmin", "ymin": "ymin", "xmax": "xmax", "ymax": "ymax" } # Set time field time = TimeInterval( interval_start_field="start_field", interval_end_field="end_field" # time instant # time = TimeInstant(time_field="pubDate") # feature_layer_config.set_time_config(time=time) ) # Set recurrence run_interval = RunInterval( cron_expression="0 * * ? * * *", timezone="America/Los_Angeles" ) # Set geometry field - configuring X,Y and Z fields geometry = XYZGeometry( x_field = "x", y_field = "y", wkid = 4326 ) # a single field geometry could also be configured # geometry = SingleFieldFeometry( # geometry_field="geometry_field" # geometry_type="esriGeometryPoint", # geometry_format="esrijson", # wkid=4326 # ) # feature_layer.set_geometry_config(geometry=geometry) feature_layer_config = FeatureLayer( label=name, description=description, query="1=1", fields="*", outSR=4326, url=url, extent=extent, time_stamp_field=time ) # Manipulate the schema - rename or remove fields, change field data-type feature_layer_config.rename_field("org_field_name", "new_field_name") feature_layer_config.remove_field("description") # Set track id feature_layer_config.set_track_id("track_id") # Set recurrence feature_layer_config.run_interval = RunInterval( cron_expression="0 * * ? * * *", timezone="America/Los_Angeles" ) # Create the feed and start it feature_layer_feed = feeds.create(feature_layer_config) feature_layer_feed.start() feeds.items
RealTimeAnalyticsManager
- class arcgis.realtime.velocity.RealTimeAnalyticsManager(url, gis)
Used to manage real-time analytic items.
Parameter
Description
url
URL of the ArcGIS Velocity organization.
gis
an authenticated
arcigs.gis.GIS
object.
BigDataAnalyticsManager
- class arcgis.realtime.velocity.BigDataAnalyticsManager(url, gis)
Used to manage big data analytic items.
Parameter
Description
url
URL of the ArcGIS Velocity organization.
gis
An authenticated
arcigs.gis.GIS
object.
Feed
- class arcgis.realtime.velocity.Feed(gis, util, item=None)
The
Feed
class implements Task and provides public facing methods to access Feed API endpoints.- delete()
Deletes an existing Feed instance.
- Returns:
A boolean containing True (for success) or False (for failure) a dictionary with details is returned.
# Delete a feed # Method: <item>.delete() sample_feed.delete()
- property metrics
Get the metrics of the running Feed for the given ID.
- Returns:
response of feed metrics
# Method: <item>.metrics # Retrieve metrics of sample_feed metrics = sample_feed.metrics metrics
- start()
Start the Feed for the given ID.
- Returns:
response of feed start
# start feed # Method: <item>.start sample_feed.start()
RealTimeAnalytics
- class arcgis.realtime.velocity.RealTimeAnalytics(gis, util, item=None)
the
RealTimeAnalytics
class implements Task and provides public facing methods to access RealTimeAnalytics API endpoints.- delete()
Deletes an existing Real-Time Analytics task instance.
- Returns:
A boolean containing True (for success) or False (for failure) a dictionary with details is returned.
# Delete a real-time analytics # Method: <item>.delete() sample_realtime_task.delete
- property metrics
Get the metrics of the running Real-Time Analytics for the given ID.
- Returns:
response of Real-Time Analytics metrics
# Retrieve metrics of real-time analytics task # Property: <item>.metrics() metrics = sample_realtime_task.metrics metrics
- start()
Start the Real-Time Analytics for the given ID.
- Returns:
response of realtime_analytics start
# Start real-time analytics # Method: <item>.start() sample_realtime_task.start()
BigDataAnalytics
- class arcgis.realtime.velocity.BigDataAnalytics(gis, util, item=None)
The
BigDataAnalytics
class implements Task and provides public facing methods to access BigDataAnalytics API endpoints.- delete()
Deletes an existing Big Data Analytics instance.
- Returns:
A boolean containing True (for success) or False (for failure) a dictionary with details is returned.
# Delete a big data analytics # Method: <item>.delete() sample_bigdata_task.delete
- property metrics
Get the metrics of the running Big Data Analytics for the given ID.
- Returns:
response of Big Data Analytics metrics
# Retrieve metrics of big data analytics task # Property: <item>.metrics() metrics = sample_bigdata_task.metrics metrics
- start()
Start the Big Data Analytics for the given ID.
- Returns:
response of bigdata_analytics start
# Start big data analytics # Method: <item>.start() sample_bigdata_task.start()
BasicAuth
CertificateAuth
- class arcgis.realtime.velocity.CertificateAuth(pfx_file_http_location, password)
This dataclass is used to specify a Basic HTTP Authentication scenario using username and password.
Parameter
Description
pfx_file_http_location
String. HTTP path of the PFX file.
password
String. Password for certificate authentication.
NoAuth
Submodules
- arcgis.realtime.velocity.feeds module
- RSS
- HttpPoller
- HttpReceiver
- HttpSimulator
- AWSIoT
- AzureEventHub
- AzureServiceBus
- CiscoEdgeIntelligence
- FeatureLayer
- StreamLayer
- Geotab
- Kafka
- MQTT
- RabbitMQ
- VerizonConnectReveal
- WebSocket
- NoAuth
- SASLPlain
- SaslScramSha256
- SaslScramSha512
- XYZGeometry
- SingleFieldGeometry
- TimeInstant
- TimeInterval
- RunInterval
- arcgis.realtime.velocity.input module