FeatureSet (arcpy)

摘要

FeatureSet 对象是要素类的轻量级表示。它们是一种既包含方案又包含数据的特殊数据元素。而且,FeatureSet 对象也表示通过服务器发送和接收要素数据的方式。

语法

FeatureSet ({table})
参数说明数据类型
table

Feature data to be loaded into the FeatureSet object.

String

属性

属性说明数据类型
JSON
(只读)

返回一个字符串形式的几何 JSON 制图表达。

提示提示:

通过 Python 的 eval 函数,返回的字符串可转换至字典。

String

方法概述

方法说明
load (table_path)

Import from a table.

save (table_path)

Export to a table.

方法

load (table_path)
参数说明数据类型
table_path

The table to be imported.

String
save (table_path)
参数说明数据类型
table_path

The output table to be created.

String

代码实例

FeatureSet 示例

将数据加载到 FeatureSet 中并插入要素类中。

import arcpy
from arcpy import env

env.overwriteOutput = True

arcpy.ImportToolbox("http://flame7/arcgis/services;BufferByVal", "server")

# List of coordinates
#
coordinateL = [[-117.196717216, 34.046944853], [-117.186226483, 34.046498438],
               [-117.179530271, 34.038016569], [-117.187454122, 34.039132605],
               [-117.177744614, 34.056765964], [-117.156205131, 34.064466609],
               [-117.145491191, 34.068261129], [-117.170825195, 34.073618099],
               [-117.186784501, 34.068149525], [-117.158325598, 34.03489167]]

# Create an in_memory feature class to initially contain the coordinate pairs
#
fc = arcpy.CreateFeatureclass_management("in_memory",
                                         "tempfc",
                                         "POINT").getOutput(0)

# Open an insert cursor
#
with arcpy.da.InsertCursor(fc, ["SHAPE@XY"]) as cursor:
    # Iterate through list of coordinates and add to cursor
    #
    for (x, y) in coordinateL:
        cursor.insertRow([(x, y)])

# Create a FeatureSet object and load in_memory feature class
#
featSet = arcpy.FeatureSet()
featSet.load(fc)

results = arcpy.BufferPoints_servertools(featSet)

相关主题

9/15/2013