how can I select or move or delete point or line on mapbox?

Topics: General Topics, SharpMap Project, SharpMap v0.9 / v1.x, WinForms Controls
Sep 29, 2014 at 8:53 PM
Hello everybody I am new at sharpmap.
I connect via postgis on my database. my database have some point(node) and some line.
I want to select any point, after selected point ı want change information point's. or move or delete point?
how can I do it ?

My sample is on link.

also my form1 code;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using SharpMap.Layers;
using SharpMap.Data.Providers;
namespace sample
    public partial class Form1 : Form
        public Form1()
        private void Form1_Load(object sender, EventArgs e)
            VectorLayer Pdpoint = new VectorLayer("dpoint", new PostGIS("server=localhost;port=5432;user=postgres;pwd=pass1;database=db", "dpoint", "geom", "id"));
            VectorLayer Ldroad = new VectorLayer("droad", new PostGIS("server=localhost;port=5432;user=postgres;pwd=pass1;database=db", "droad", "geom", "id"));
my app output image link
my datebase image link
Oct 1, 2014 at 9:24 AM
There is no core functionality to edit geometries. You'd have to code that yourself
Oct 1, 2014 at 7:33 PM
Thank you for your reply.
 private SharpMap.Data.FeatureDataRow FindGeoNearPoint(GeoAPI.Geometries.IPoint point, SharpMap.Layers.VectorLayer layer, double amountGrow)
            var box = new GeoAPI.Geometries.Envelope(point.Coordinate);

            var fds = new SharpMap.Data.FeatureDataSet();
            layer.DataSource.ExecuteIntersectionQuery(box, fds);

            SharpMap.Data.FeatureDataRow result = null;
            var minDistance = double.MaxValue;

            foreach (SharpMap.Data.FeatureDataTable fdt in fds.Tables)
                foreach (SharpMap.Data.FeatureDataRow fdr in fdt.Rows)
                    if (fdr.Geometry != null)
                        var distance = point.Distance(fdr.Geometry);
                        if (distance < minDistance)
                            result = fdr;
                            minDistance = distance;
            return result;
private void mapBox1_MouseUp(GeoAPI.Geometries.Coordinate worldPos, MouseEventArgs imagePos)
SharpMap.Data.FeatureDataRow rowSelected=FindGeoNearPoint( pointClick, layerSelected,50);
how can I highlight my selected point with mouseup ?
Oct 1, 2014 at 9:19 PM
 private void mapBox1_MouseUp(GeoAPI.Geometries.Coordinate worldPos, MouseEventArgs imagePos)
            GeoAPI.Geometries.IPoint point = new NetTopologySuite.Geometries.Point(worldPos.X, worldPos.Y);
            VectorLayer Pdpoint = new VectorLayer("dpoint", new PostGIS("server=localhost;port=5432;user=postgres;pwd=hs427034;database=kgmdb", "dpoint", "geom", "id"));
            SharpMap.Data.FeatureDataRow rowSelected = FindGeoNearPoint(point, Pdpoint, 100);
            SharpMap.Layers.VectorLayer laySelected = new SharpMap.Layers.VectorLayer("Selection");
            laySelected.DataSource = new SharpMap.Data.Providers.GeometryProvider(rowSelected.Geometry);
            laySelected.Style.Line = new Pen(Color.Red, 10F);
            laySelected.Style.SymbolScale = 10f;
            laySelected.Style.Symbol = new System.Drawing.Bitmap("D:/GIS EYLÜL 2014/SHARPMAP PROJE/27 EYLÜL/EYLÜL27/EYLÜL27/Resources/Car.gif");
add this code on my app.
when I click once it works. but second click get error code. where is the wrong things?
An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll

Additional information: An item with the same key has already been added.
Oct 2, 2014 at 5:20 AM
You keep adding layers with THW Name "Selection" to the Map.Layers.