FeatureSet

Resumen

FeatureSet objects are a lightweight representation of a feature class. They are a special data element that contains not only schema, but also the data. The FeatureSet object is also how feature data is sent and received from the server.

Sintaxis

FeatureSet ({table})
ParámetroExplicaciónTipo de datos
table

Feature data to be loaded into the FeatureSet object.

String

Vista general del método

MétodoExplicación
load (table_path)

Import from a table.

save (table_path)

Export to a table.

Métodos

load (table_path)
ParámetroExplicaciónTipo de datos
table_path

The table to be imported.

String
save (table_path)
ParámetroExplicaciónTipo de datos
table_path

The output table to be created.

String

Ejemplo de código

FeatureSet example

Load data into FeatureSet and insert into feature class.

# Loading data to a FeatureSet using cursors 
#  and an in_memory feature class.
#
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")

# Open an insert cursor
#
cur = arcpy.InsertCursor(fc)
pointArray = arcpy.Array()
pnt = arcpy.Point()

# Iterate through list of coordinates and add to cursor
#
for coords in coordinateL:
    x,y = coords.split(';')

    pnt.ID = coordinateL.index(coords) + 1
    pnt.X = x
    pnt.Y = y

    feat = cur.newRow()
    feat.shape = pnt
    cur.InsertRow(feat)
    pointArray.add(pnt)

# Create a FeatureSet object and load in_memory feature class
#   then pass featureset to server tool.
featSet = arcpy.FeatureSet()
featSet.load(fc)

results = arcpy.BufferPoints_server(featSet)

# Delete the cursor
del cur

Temas relacionados


7/10/2012