Featureset feature attributes no longer serialized

652
0
09-24-2012 06:56 AM
MatthewPilgrim
New Contributor III
Hi,

We were using the following code to add attributes to a feature in a featureset and then pass it as a parameter to a GP tool.  This worked in version 2.2 of the API. 

//g is loaded from a layer elsewhere and has several valid attributes
FSet = new FeatureSet();
g.Attributes.Add("BaseElev", 1234);
FSet.Features.Add(g);
parameters.Add(new GPFeatureRecordSetLayer("BuildingPolygons_Input", FSet));


After upgrading to v3.0 this stopped working.  Any attributes that were not originally loaded on the graphic (i.e. manually added attributes) are missing from the JSON used to call the GP tool. 

I have found this post and fixed the issue using the following code. 

FSet.Fields = new List<Field>();
FSet.Fields.Add(new Field("BaseElev", Field.FieldType.Double, "BaseElev", null, true, true, 0));


Was this change of behaviour intentional?  Where was it documented?  Have I done the correct thing?

thanks, Matt
0 Kudos
0 Replies