Filling colour in polygon feature within a feature layer

01-07-2019 12:51 AM
New Contributor III

Hello all,

I am working on an add-in that calculates the ground deformations induced due to underground tunnel. After that I have some buildings (Polygon feature layer) on the surface that are prone to damage by the deformations. I am calculating the damage and for assessment purpose, based on calculated damage for each building I want to fill in different colours in different building polygons.

Currently I applied buffer for convenience but buffer colours all the polygons at once and also, I cannot change the buffer colour as well. If someone can help that will be helpful.Description of the assignmentBuildings buffered

the lower picture shows the buffered buildings along the tunnel route.

private async void button1_ClickAsync(object sender, EventArgs e)



string layerName = "BuildingsD";

var sectionLayer = MapView.Active.Map.GetLayersAsFlattenedList().FirstOrDefault((lyr) => lyr.Name.StartsWith(layerName)) as FeatureLayer;

if (sectionLayer == null)


ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Buildings not found");







string st_in = Convert.ToString(sectionLayer);

//string st_out = "BuildingD_Buffer";

//string Distance = "Field, OBJECTID";

var args = Geoprocessing.MakeValueArray(st_in, null, @"7 Meters");

string tool_path = "analysis.Buffer";

IGPResult ret = await Geoprocessing.ExecuteToolAsync(tool_path, args/*, envArray*/);

if (ret.IsFailed)


ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show($@"Error {ret.ErrorCode} in GP Tool: {ret.ErrorMessages}");



catch (Exception)

{ }

The above code I used to buffer the buildings but I can't get how do I select individual building and fill the colour or change the buffer colour for the selected building feature.

0 Kudos
0 Replies