I want to edit the corresponding text/numeric data type columns of a vector through OpenLayers when a user clicks/mouse over a vector. like,
http://dev4.mapgears.com/bdga/bdgaWFS-T.html#
any tutorial page for how to do it? I have gone through it, it was difficult for me to understand its js codes.
-- asked in StackOverflow, but no answers. based on a comment, I posted the same question here.
2 Answers 2
The "How" is actually quite easy - all you need is a WFS-T server and a WFS-T capable client. You have already picked OpenLayers as your client which is a good choice as it has no problems with talking WFS-T (see http://openlayers.org/dev/examples/wfs-protocol-transactions.html).
For the server you have a choice to make - since your data is in PostGIS you are looking at GeoServer http://geoserver.org or TinyOWS http://www.tinyows.org/trac for a WFS-T server. There are plenty of docs on either site to help you get started.
-
1WFS-T is the best solution2010年09月17日 17:34:58 +00:00Commented Sep 17, 2010 at 17:34
-
1editing geometry data is ok, but how to edit other columns of the postgis data associated with the geom? for that how to get existing data and after modifying it how to add it to openlayer wfs-t functions? so that when altering the_geom it is altering other values also.Kumar– Kumar2010年09月18日 08:17:38 +00:00Commented Sep 18, 2010 at 8:17
-
That can be done with a basic form if you want complete control or look at MapFish's <demo.mapfish.org/mapfishsample/1.2/examples/editing/…>Ian Turton– Ian Turton2010年09月18日 11:06:46 +00:00Commented Sep 18, 2010 at 11:06
-
nice, but mapfish is python based, i actually not interested to make the project more complicated by adding mapfish.where to add the other colums data in openlayers to make effect in DB, while updating geom columns? thats enough for me.. Thanks for your interest on my question, Mr Lant.Kumar– Kumar2010年09月18日 11:10:51 +00:00Commented Sep 18, 2010 at 11:10
"How" you do it is likely strongly linked to your toolset. But, I suspect in any toolset your flow will be something like this:
- Select the feature you want to edit (by map click, by search, etc...) and store the unique identifier.
- Retrieve the row from the database using the unique identifier as the filter.
- Parse the database row and create an "editor" (combobox, textbox, datepicker, etc...) for each column.
- Present the user with an interface based on the current values in the row and the editors.
- As the user enters / modifies data validate the input.
- On save, fashion an update query based on the user provided values and using the unique identifier as the filter.
- If you are using attribute information the user can edit to render the map (e.g. road symbol is based on roadtype attribute which is editable) then update the map.
-
I totally agree with iant's response that WFS-T is the best way to carry out the edit of the features, but that is only part of the toolset. You've got the get the edits to carry out. JavaScript? PHP? .NET? All of the above?Dave Lowther– Dave Lowther2010年09月18日 00:13:56 +00:00Commented Sep 18, 2010 at 0:13
-
Ya Lowther, But how to do it with the available openlayers functions that I want to know?.Kumar– Kumar2010年09月18日 08:14:26 +00:00Commented Sep 18, 2010 at 8:14
-
2@Kumar, no built openlayers functions for editing attributes. Geoext have some for doing this eg dev.geoext.org/ux/geoext.ux/ux/FeatureEditing/examples/…ThomasG77– ThomasG772010年09月19日 20:00:22 +00:00Commented Sep 19, 2010 at 20:00
-
Hi ThomasG77 , great comment... I will try it..Kumar– Kumar2010年09月20日 06:52:19 +00:00Commented Sep 20, 2010 at 6:52