how to convert feature class to feature set in python

3665
5
03-28-2016 01:22 AM
jayasudha
New Contributor III

hi

hi

how to convert featureclass object to featureset object using python and how to convert featureset into featureclass.

please help me with some small code snippet.

Tags (2)
0 Kudos
5 Replies
DanPatterson_Retired
MVP Emeritus

did you see Featureset in the help files and some of its arcpy methods

FeatureSet—Help | ArcGIS for Desktop

jayasudha
New Contributor III

hi

I found in the documentation that ArcGIS server accepts featureset as input and output, but not featureclass. Do i need to convert following script to publish gp service ? If yes how ?

import arcpy

Buffer_distance = arcpy.GetParameterAsText(0)

citybuffer = arcpy.GetParameterAsText(1)

cities = "C:\\project\\test.gdb\\cities"

arcpy.Buffer_analysis(cities, citybuffer, Buffer_distance, "FULL", "ROUND", "NONE", "")

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

There is a sample script at the bottom of the page that Dan linked to. But the command is

feature_set.load(feature_class)

try using your "cities" as the feature_class input and see if that works.

AndrewKeith3
Occasional Contributor

Do you want the GP service to always use the data referenced in the cities variable? Or, do you want to supply a different cities layer each run?

0 Kudos
jayasudha
New Contributor III

Thanks to all for suggestions.

GP service always use data referenced in cities variable.

0 Kudos