I am working on creating a custom GP Tool in C#.I have created the tool and registered it for Desktop and it runs as expected.I then registered the tool on Server and published the result from desktop.From Desktop I am able to execute the published server tool and it works as expected.Calling the same server tool from the WPF Runtime 10.1.1 results in the following error:Error code '400': 'Unable to complete operation.'the input is not a geographic or projected coordinate systemThis error makes no sense to me because: var spatialReference = new SpatialReference("GCS_North_American_1983"); //4269
//var spatialReference = new SpatialReference(4269);
var call = new FeatureSet
{
GeometryType = GeometryType.Point,
SpatialReference = spatialReference
};
call.Features.Add(new Graphic { Geometry = new MapPoint(-122.1869709520000000, 47.6350545160001000, spatialReference) });
Geoprocessor geoprocessorTask = new Geoprocessor("http://localhost:6080/arcgis/rest/services/CalculateProximity4/GPServer/Calculate%20Proximity");
geoprocessorTask.OutputSpatialReference = spatialReference;
geoprocessorTask.ProcessSpatialReference = spatialReference;
var param1 = new GPRecordSet("input_call_point", call);
param1.FeatureSet.SpatialReference = spatialReference;
var param2 = new GPRecordSet("input_units_features", _units);
param2.FeatureSet.SpatialReference = spatialReference;
List<GPParameter> parameters = new List<GPParameter>();
parameters.Add(param1);
parameters.Add(param2);
I seem to be setting the spatial reference on every possible location I see.I have a model that I used to create a gpk for doing local routing that passes the same types of parameters with the exact same code that works either as a local package or as a GP Service hosted in ArcGIS Server 10.2. The only difference I see between those services definition is this:For the routing task that works I see this as the definition of the parameter on the server:Parameter: Stops Data Type: GPFeatureRecordSetLayer Display Name Stops Description: Point to Point Routing Direction: esriGPParameterDirectionInput Default Value:Geometry Type: esriGeometryPoint HasZ: false HasM: false Spatial Reference: 4269 (4269) Fields:OBJECTID ( type: esriFieldTypeOID , alias: OBJECTID )Features: None.For the Custom GP Tool I see this, which has no spatial reference.Parameters: Parameter: input_call_point Data Type: GPFeatureRecordSetLayer Display Name Input Call Description: call Direction: esriGPParameterDirectionInput Default Value:Geometry Type: HasZ: false HasM: false Spatial Reference: N/A Fields: NoneFeatures: None.I have looked all over and can not find a way in my C# code to set the spatial reference on the default value for my parameters. All the examples I see do the exact same thing I do. IGPParameterEdit3 inputParameter = new GPParameterClass();
inputParameter.DataType = new GPFeatureRecordSetLayerType() as IGPDataType;
inputParameter.Value = defaultRSLayer as IGPValue;
inputParameter.Direction = esriGPParameterDirection.esriGPParameterDirectionInput;
inputParameter.DisplayName = "Input Call";
inputParameter.Name = "input_call_point";
inputParameter.Domain = (IGPDomain)fcDomain;
inputParameter.ParameterType = esriGPParameterType.esriGPParameterTypeRequired;
parameters.Add(inputParameter);
I am really at a loss as to how to create a default value with a spatial reference set. I would really rather not have to set the spatial reference for the default value, but that is all I see as different between the service that works from my model and my custom GP tool.Thanks in Advance,John