Editing in map that connected to PostGIS

Topics: SharpMap v2.0
Jul 7, 2009 at 3:44 PM
Edited Jul 7, 2009 at 3:51 PM

Hi all

private void btnShowMap_Click(object sender, EventArgs e)

        {

           

            myMap.BackColor = Color.White; //Set background

            myMap.Size = mapImage1.Size;

            SharpMap.Layers.VectorLayer postGISLayer = new SharpMap.Layers.VectorLayer("nile");

 

            string ConnStr = "Server=127.0.0.1;Port=5432;User Id=postgres;Password=password;Database=postgis;";

            postGISLayer.DataSource = new SharpMap.Data.Providers.PostGIS(ConnStr, "nile", "oid");

            

            myMap.Layers.Add(postGISLayer);

            myMap.ZoomToExtents();

           

            mapImage1.Image = myMap.GetMap();

             MessageBox.Show("Completed");

        }

I show map from PostGIS successfully by using the prev method.

Now,I want to enable user to make editing in map then it automatic modified in the source which is PostGIS

Can anyont help me?

Mohammed Thabet Zaky Mohammed

GIS Developer

Egypt,cairo

http://www.thabettech.blogspot.com/

 

Coordinator
Jul 7, 2009 at 4:07 PM

Hi Mohammed, in 0.9 all the providers are readonly, however you could implement it fairly easily.. I would suggest starting by:

subclassing the PostGIS or PostGIS2 provider
adding a method which takes either a FeatureDataTable or IEnumerable<FeatureDataRow> and
builds and caches a parameterized update statement (perhaps with a CommandBuilder)
loops through each item in the input updating the parameters and executing the statement

hth jd