I am creating a shapefile using DotSpatial library in Microsoft Visual Studio and C# programming language. The shapefile consists of a Polygon layer. Each polygon in the layer needs to have a specific fertilizer value. As far as my understanding goes, I have to first create a field (say "Fertilizer value") and then add corresponding fertilizer value to it for each polygon created. I have created a field and have created a Polygon. However, I am still struggling to find the right way to add a fields value in the corresponding Polygon. The code is as below:
// Create a feature set of type Polygon and set the projection
FeatureSet fs = new FeatureSet(FeatureType.Polygon);
fs.Projection = ProjectionInfo.FromAuthorityCode("EPSG", 3857);
// Get the DataTable and set the fertilizer field
DataTable table = fs.DataTable;
DataColumn FertilizerField = table.Columns.Add("Fertilizer Value", typeof(double));
// Adding a Polygon feature to the layer
Coordinate[] coord = new Coordinate[]
{
new Coordinate(0.0, 0.0),
new Coordinate(1.0, 0.0),
new Coordinate(1.0, 1.0),
new Coordinate(0.0, 1.0),
new Coordinate(0.0, 0.0)
};
fs.AddFeature(new Polygon(new LinearRing(coord)));
// TODO: HOW TO ADD FERTILIZER VALUE OF 100 TO THE FERTILIZER FIELD OF THIS POLYGON?
My question is, how do I set the fields value for this polygon?