I want to edit the corresponding text/numeric data type columns of a vector through openlayres, when a user click/mouse over a vector. like,


any tutorial page for how to do it? I gone through it , it was difficult for me to understand from 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.

  • 1
    WFS-T is the best solution
    – Mapperz
    Sep 17, 2010 at 17:34
  • 1
    editing 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
    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
    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
    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:

  1. Select the feature you want to edit (by map click, by search, etc...) and store the unique identifier.
  2. Retrieve the row from the database using the unique identifier as the filter.
  3. Parse the database row and create an "editor" (combobox, textbox, datepicker, etc...) for each column.
  4. Present the user with an interface based on the current values in the row and the editors.
  5. As the user enters / modifies data validate the input.
  6. On save, fashion an update query based on the user provided values and using the unique identifier as the filter.
  7. 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? Sep 18, 2010 at 0:13
  • Ya Lowther, But how to do it with the available openlayers functions that I want to know?.
    – Kumar
    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
    Sep 19, 2010 at 20:00
  • Hi ThomasG77 , great comment... I will try it..
    – Kumar
    Sep 20, 2010 at 6:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.