Delete point by name

Mar 28, 2012 at 5:02 PM


I want to show the location of several GPS receivers.

  FeatureSet pointF = new FeatureSet(FeatureType.Point);
//create point layer
  private void button1_Click(object sender, EventArgs e)
            pointF.Projection = map1.Projection;
            DataColumn columnID = new DataColumn("PointID");
            if (!pointF.DataTable.Columns.Contains("PointID"))
            MapPointLayer pointLayer = new MapPointLayer(pointF);
            PointSymbolizer symbol = new PointSymbolizer(Color.Red, DotSpatial.Symbology.PointShape.Rectangle, 5);
            pointLayer.Symbolizer = symbol;
            pointLayer.LegendText = "point";
            pointmouseClick = true;

//emulation of the arrival of the GPS data
  private void map1_MouseDown(object sender, MouseEventArgs e)
             if (e.Button == MouseButtons.Left && (pointmouseClick))
                string PointID = textBoxID.Text;
                Coordinate coord = map1.PixelToProj(e.Location);
                DotSpatial.Topology.Point point = new DotSpatial.Topology.Point(coord);
                IFeature currentFeature = pointF.AddFeature(point);
                currentFeature.DataRow["PointID"] = PointID;

If the new point has a pointID that already exists on the map, delete this point with the same ID. How to remove the point?



Mar 28, 2012 at 10:25 PM
Edited Mar 28, 2012 at 10:38 PM
        private void DeleteExistingPoint(string pointID)
            MapPointLayer layer = default(MapPointLayer);
            layer = (MapPointLayer)map1.Layers[0];
            DataRowCollection featureSetRows = pointF.DataTable.Rows;
            for (int i = 0; i < featureSetRows.Count; i++)
                if (featureSetRows[i].ItemArray[0].ToString() == pointID)
                    IFeature f = pointF.FeatureFromRow(featureSetRows[i]);
I did it) If you can do it another way, please tell me how.
Tell me how to use labels, please.
 	MapPointLayer labelLayer = new MapPointLayer();
 	labelLayer = (MapPointLayer)map1.Layers[0];
 	map1.AddLabels(labelLayer, "[PointName]", new Font("Tahoma", (float)10.0), Color.Black);

It's not a best variant. In this case, the symbol of point and name are superimposed on each other. I want to see them separately.
Sep 15, 2016 at 2:17 PM
hello someone could help me with my problem as I can delete points

Thanks in advance