当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python ArcGIS FeedsManager.create用法及代码示例


本文简要介绍 python 语言中 arcgis.realtime.velocity.FeedsManager.create 的用法。

用法:

create(feed=None)

返回:

新创建的 Feed 的 ID 和标签

创建新的 feed 配置。

Parameter

Description

feed

提要的实例,例如 RSS 或 HTTP 轮询器。

例子:

# 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

相关用法


注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 arcgis.realtime.velocity.FeedsManager.create。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。