This project is read-only.

Add feature problem

Apr 3, 2014 at 3:22 PM
I want to add feature in mouse click Like this:
private void map1_MouseClick(object sender, MouseEventArgs e)
        FeatureLayer featureLayer = null;
        FeatureSet featureSet = null;
        if (map1.Layers.Count > 0)
            featureLayer = map1.Layers[0] as FeatureLayer;
            featureSet = featureLayer.DataSet as FeatureSet;
            featureSet.Projection = DotSpatial.Projections.KnownCoordinateSystems.Geographic.World.WGS1984;
            Coordinate coordinate = map1.PixelToProj(e.Location);
            DataColumn column = new DataColumn("PolygonID");
            DataColumn column2 = new DataColumn("Cord");
            if (!polyLayer.DataSet.DataTable.Columns.Contains("PolygonID"))
            if (!polyLayer.DataSet.DataTable.Columns.Contains("Cord"))
            DotSpatial.Topology.Point point = new DotSpatial.Topology.Point(coordinate);
            Feature feature = new Feature(point);
           IFeature k= featureSet.AddFeature(feature);
            k.DataRow["PolygonID"] = "Test";
            k.DataRow["Cord"] = coordinate.ToString();
it is ok but when I close map and add this map again and want to add other feature in mouse click there is error that featureset index was out of range.
please help me.
Apr 5, 2014 at 6:19 PM
no anyone to help me ???
Apr 5, 2014 at 6:46 PM
there is no this error when I Add mapLineLayer.
Please help