How to set Geoprocessing field_mapping parameter in SDK

821
2
Jump to solution
11-13-2017 02:27 AM
GwenRoyakkers
New Contributor III

Is it possible to set the fieldmappings parameter for spatial-join (or another geoprocessor) from the sdk?

In Arcobjects you would use the IGPFieldMapping object and in Python the arcpy.FieldMappings object.

 

I Only want/need 1 field from join_features. 

I can't find anything about this topic in the SDK documentation, and the community samples only use simple string based parameters.

Is there a renamed object that I'm missing, or is this functionality missing from ArcGIS Pro .Net SDK?

Removing/renaming the unused fields afterwards is not an acceptable workaround (There are way to many fields for this, and removing a field from the Geoprocessing framework is a lot slower than ArcObjects).

Thanks!

0 Kudos
1 Solution

Accepted Solutions
GwenRoyakkers
New Contributor III

As a workaround I build a function that wil convert a list of my own FieldMapping Classes to a correct formatted string for the Geo processing parameter.

The parameters from the geo processing history gave me a clue on how to format the field mappings to text myself.

A decent ESRI solution would be preferable though. Because building the text on your own leaves room for errors, and you need to know the fields of both feature classes.

View solution in original post

0 Kudos
2 Replies
GwenRoyakkers
New Contributor III

As a workaround I build a function that wil convert a list of my own FieldMapping Classes to a correct formatted string for the Geo processing parameter.

The parameters from the geo processing history gave me a clue on how to format the field mappings to text myself.

A decent ESRI solution would be preferable though. Because building the text on your own leaves room for errors, and you need to know the fields of both feature classes.

0 Kudos
ole1986
New Contributor III

@GwenRoyakkers Any chance to get an example code on how you have resolved it?

0 Kudos