How to pass Features as GPstring in Localserver

486
1
11-19-2019 10:12 PM
Sharan_saiGudibanda_Nagesh
New Contributor

Hi,

I was able to create a geopackage of Observer Points and provide arcgis runtime support. While creating in ArcGIS Pro i have provided the inputs a raster image and Feature Points. Now i am trying to run this package with arcgis runtime localserver, it has asking the Observer Point Features in GPString. 

// Create a new feature collection table based upon point geometries using the current map view spatial reference
FeatureCollectionTable myInputFeatures = new FeatureCollectionTable(new List<Field>(), GeometryType.Point, MyMapView.SpatialReference);

// Create a new feature from the feature collection table. It will not have a coordinate location (x,y) yet
Feature myInputFeature = myInputFeatures.CreateFeature();

// Assign a physical location to the new point feature based upon where the user clicked in the map view
myInputFeature.Geometry = location;

// Add the new feature with (x,y) location to the feature collection table
await myInputFeatures.AddFeatureAsync(myInputFeature);

// Create the parameters that are passed to the used geoprocessing task
GeoprocessingParameters myViewshedParameters =
new GeoprocessingParameters(GeoprocessingExecutionType.SynchronousExecute)
{

// Request the output features to use the same SpatialReference as the map view
OutputSpatialReference = MyMapView.SpatialReference
};
// Add an input location to the geoprocessing parameters
myViewshedParameters.Inputs.Add("in_observer_point_features", new GeoprocessingFeatures(myInputFeatures));
myViewshedParameters.Inputs.Add("in_raster", new GeoprocessingString(@"D:\ArcGISPro\ArcGISPro\Documentation\Files\Maps\IndiaMap\gt30e060n40.tif"));

The above code is where i have creating the feature points from the mouse tap event. and storing it in a feature class.

Please provide a way where i can transfer these Features as a string as the Geopackage input type is GPString.

Regards

G N Sharan Sai

0 Kudos
1 Reply
MichaelBranscomb
Esri Frequent Contributor

Hi,

When packaging (or creating your model/script) you should specify that input parameter as a FeatureSet, which will match with the API type GeoprocessingFeatures Class

For a sample see: Analyze viewshed (geoprocessing) | ArcGIS for Developers 

Also see Author and publish a geoprocessing model—ArcGIS Runtime SDK for .NET | ArcGIS for Developers 

Regards

Mike

0 Kudos