MikeEber

Trying to understand parameter passing to service layer

Discussion created by MikeEber on Oct 10, 2013
I am new to ArcGIS and trying to get a server-based function written.  As such I'm trying to understand parameter passing from the ArcGIS clients.

All of the tools that are already existing have their calls to the server service defined where it appears they are passed to the service as IGPParameter3 types and treated like Feature Sets(?).  It doesn't matter if it is integer, an integer array, or an ESRI Point, or whatever.  However with that said it also is code that is not that well written by people that no longer work here. 

Is this really the way ESRI dictates this?  I cannot pass a Point as a parameter to a service? All I want to do is pass a Point, an array of Points, and get back a Polyline.  It seems simple enough so can I just do that?

This is how they create parameters to services now which seems extremely excessive just to pass a point:
            IFeatureWorkspace pFeatWksp = GPDatabase.GetRMWWorkspace();
            IFeatureClass pFC = pFeatWksp.OpenFeatureClass(schemaName);

            IRecordSetInit recordset = new RecordSetClass();
            recordset.SetSourceTable((ITable)pFC, null);
            IGPRecordSet gpRS = new GPRecordSetClass();
            gpRS.RecordSet = (IRecordSet)recordset;
            IGPRecordSet gpR = new GPFeatureRecordSetLayerClass();
            gpR.RecordSet = (IRecordSet)recordset;
            IGPFeatureRecordSetLayer gpFRSL = (IGPFeatureRecordSetLayer)gpR;

            IGPFeatureSchema fgs = new GPFeatureSchemaClass();
            fgs.GeometryType = esriGeometryType.esriGeometryPoint;
            IGPSchema gpSchema = (IGPSchema)fgs;

            IGPFeatureClassDomain geomTypeDomain = new GPFeatureClassDomainClass();
            geomTypeDomain.AddType(esriGeometryType.esriGeometryPoint);

            IGPParameterEdit3 parameterEdit = new GPParameterClass
            {
                IGPParameterEdit_Name = name,
                IGPParameterEdit_DisplayName = displayName,
                IGPParameterEdit_DataType = gpDataType,
                IGPParameterEdit_Value = (IGPValue)gpFRSL,
                IGPParameterEdit3_Schema = gpSchema,
                IGPParameterEdit3_Domain = (IGPDomain)geomTypeDomain,
                IGPParameterEdit_ParameterType = paramType,
                IGPParameterEdit_Direction = paramDirection,
                IGPParameterEdit_Enabled = true
            };

            return parameterEdit;


In trying to understand this I am also totally confused by how the server side pulls the values out of the parameter.  It almost looks like it is treated like a database table though it isn't. 

Totally Confused in Nashville.  :)

Michael

Outcomes