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
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.
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.
Get/Set property used for filtering the streamed features so they meet spatial and SQL like criteria, and return the specified fields.
Get/Set the spatial reference of the streamed features.
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.
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
Provides access to the resource manager for managing configured big data analytic tasks in ArcGIS Velocity.
# Get instance of bigdata_analytics from `velocity`: bigdata_analytics = velocity.bigdata_analytics bigdata_analytics
Provides access to the resource manager for managing configured feeds in ArcGIS Velocity.
# Get instance of feeds from `velocity`: feeds = velocity.feeds feeds
Provides access to the resource manager for managing configured real-time analytic tasks in ArcGIS Velocity.
# Get instance of realtime_analytics from `velocity`: realtime_analytics = velocity.realtime_analytics realtime_analytics
Used to manage a feed item.
Parameter
Description
url
URL of the ArcGIS Velocity organization.
gis
An authenticated GIS
object.
Creates a new feed configuration.
Parameter
Description
feed
An instance of a feed such as RSS or HTTP Poller.
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
Get feed by ID.
Parameter
Description
id
Unique ID of a feed.
endpoint response of feed for the given id and label.
# Get feed by id # Method: <item>.get(id) sample_feed = feeds.get("id")
Get all feeds.
returns a collection of all configured feed tasks with feed id and feed label.
# Get all feeds item all_feeds = feeds.items all_feeds
Used to manage real-time analytic items.
Parameter
Description
url
URL of the ArcGIS Velocity organization.
gis
an authenticated arcigs.gis.GIS
object.
Get real-time analytic item by ID.
Parameter
Description
id
Unique ID of a real-time analytic.
endpoint response of real-time analytics for the given id and label
# Get real-time analytics by id # Method: <item>.get(id) sample_realtime_task = realtime_analytics.get("id")
Get all real-time analytic items.
returns a collection of all real-time analytics items with id and label.
# Get all real-time analytics items all_realtime_analytics = realtime_analytics.items all_realtime_analytics
Used to manage big data analytic items.
Parameter
Description
url
URL of the ArcGIS Velocity organization.
gis
An authenticated arcigs.gis.GIS
object.
Get big data analytic items by ID.
Parameter
Description
id
Unique ID of a big data analytic task.
endpoint response of Big Data Analytics for the given id and label
# Get big data analytics by id # Method: <item>.get(id) sample_bigdata_task = bigdata_analytics.get("id")
Get all big data analytic items.
returns a collection of all configured Big Data Analytics items
# Get all big data analytics all_bigdata_analytics = bigdata_analytics.items all_bigdata_analytics
The Feed
class implements Task and provides public facing methods to access Feed API endpoints.
Deletes an existing Feed instance.
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()
Get the metrics of the running Feed for the given ID.
response of feed metrics
# Method: <item>.metrics # Retrieve metrics of sample_feed metrics = sample_feed.metrics metrics
Start the Feed for the given ID.
response of feed start
# start feed # Method: <item>.start sample_feed.start()
Get the status of the running Feed for the given ID. :return: response of Feed status
# Retrieve status of sample_feed # Method: <item>.status Sample_feed = feeds.get("id") status = sample_feed.status status
Stop the Feed for the given ID. Return True if the Feed was successfully stopped.
boolean
# stop feed # Method: <item>.stop sample_feed.stop()
the RealTimeAnalytics
class implements Task and provides public facing methods to access RealTimeAnalytics API endpoints.
Deletes an existing Real-Time Analytics task instance.
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
Get the metrics of the running Real-Time Analytics for the given ID.
response of Real-Time Analytics metrics
# Retrieve metrics of real-time analytics task # Property: <item>.metrics() metrics = sample_realtime_task.metrics metrics
Start the Real-Time Analytics for the given ID.
response of realtime_analytics start
# Start real-time analytics # Method: <item>.start() sample_realtime_task.start()
Get the status of the running Real-Time Analytics for the given ID.
response of Real-Time Analytics status
# Retrieve status of real-time analytics task # Property: <item>.status() status = sample_realtime_task.status status
Stop the Real-Time Analytics for the given ID. Return True if the the Real-Time Analytics was successfully stopped.
boolean
# Stop real-time analytics # Method: <item>.stop() sample_realtime_task.stop()
The BigDataAnalytics
class implements Task and provides public facing methods to access BigDataAnalytics API endpoints.
Deletes an existing Big Data Analytics instance.
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
Get the metrics of the running Big Data Analytics for the given ID.
response of Big Data Analytics metrics
# Retrieve metrics of big data analytics task # Property: <item>.metrics() metrics = sample_bigdata_task.metrics metrics
Start the Big Data Analytics for the given ID.
response of bigdata_analytics start
# Start big data analytics # Method: <item>.start() sample_bigdata_task.start()
Get the status of the running Big Data Analytics for the given ID.
response of Big Data Analytics status
# Retrieve status of big data analytics task # Property: <item>.status() status = sample_bigdata_task.status status
Stop the Big Data Analytics for the given ID. Return True if the Big Data Analytics was successfully stopped.
boolean
# Stop big data analytics # Method: <item>.stop() sample_bigdata_task.stop()
This dataclass is used to specify a Basic HTTP Authentication scenario using username and password.
Parameter
Description
username
String. Username for basic authentication.
password
String. Password for basic authentication.
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.
This dataclass is used to specify the no HTTP authentication scenario.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4