AnsweredAssumed Answered

Sample for calling a GP Service Task with with multiple features??

Question asked by ti@rapidis.com on May 6, 2013
Latest reply on May 10, 2013 by ti@rapidis.com
[Apologies for re-posting, but I wanted to change the title as it was misleading, and the forum wouldn't let me change anything.]

I would like to call a Geoprocessing Service from the WPF SDK, but I am having problems.

The model I published has several inputs - most of the non-spatial table data and those work fine, but in addition it has a feature layer / class, for which I cannot get data into the service.

I was hoping that someone could point me to a sample that does this.

There are plenty of samples, but they all seem to load just one single feature into the service. This is unfortunate, since the API has a specific "shorthand" for this single-feature-case, whereas the more general case is not shown.

I can see that the features are actually being transmitted to the server, since I have found them in JSON form in a file called definitions.dat under the server jobs folder. But I still think I must be doing something wrong since the model that is running on the server "sees" an empty input (as evidenced by my use of the GetCount Tool).

Here is an abbreviated version of my code:
m_gp = new Geoprocessor("http://server:6080/arcgis/rest/services/Name/GPServer/Name");
List<GPParameter> parameters = new List<GPParameter>();
List<Graphic> graphics = new List<Graphic>();
while(notDone)
{
Graphic graphic = new Graphic();
IDictionary<string, object> record = graphic.Attributes;
point = new MapPoint();
point.X = x_value;
point.Y = y_value;
record.Add("field1","value1");
point.SpatialReference = new SpatialReference(25832);
graphic.Geometry = point;
}
graphics.Add(graphic);

GPParameter prm;
FeatureSet fSet = new FeatureSet(graphics);
fSet.SpatialReference = new SpatialReference(25832);
prm = new GPFeatureRecordSetLayer(recordSetName, fSet);
parameters.Add(prm)

// add more parameters

m_gp.SubmitJobAsync(parameters);

Help please! I am completely stuck.

Outcomes