Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
  • I'm new in OpenLayers.
  • I have simple application, which use a picture as map,
  • on this picture users can add, move, or delte point, and then save.

  • I have implemented adding, moving, deleting functionalities, only except save.

  • codes are in below :

codes here

  • anyone who knows how to save change on server side? save to database, file?
share|improve this question
Repeated question? "How do I edit info feature attributes in geoserver with openlayer" ( – dariapra Nov 22 '12 at 11:29

I found a cool sample that illustrates the handling. Take a look at this (the source code :-D)

Your vector layer needs a server part two handle the persistence. The save strategy only triggers the write back.

/* from the sample source */
var scribble = new OpenLayers.Layer.Vector("Scribble", {
    protocol: new OpenLayers.Protocol.HTTP({
        url: "featureserver/featureserver.cgi/scribble",
        format: new OpenLayers.Format.GeoJSON()
    strategies: [new OpenLayers.Strategy.BBOX(), new OpenLayers.Strategy.Save({auto: true})],
    projection: wgs
share|improve this answer
hi, thank your replay firstly. I've tried whole day on this, current the source as in below: I can load data use protocol now, but still didn't try out how to save data, save function is triggered, but how to do next, any suggestion on this? – lune Nov 23 '12 at 9:09
I know it can be implemented by sending a ajax request, but want to learn how to use openlayers – lune Nov 23 '12 at 9:24
after adding saveStrategy to pointLayer, now the commit function can be triggered when clicking save button, source : how to send request in commit function using openlayers way? – lune Nov 23 '12 at 9:51
I'm not sure if I'm right but imo if you add the right URL to your vector layer it automatic writes the data back. But you need a related server part. For instance a wfs server or a script that handles the request server side. The post from rashad give you some sample components for that – OkieOth Nov 23 '12 at 10:25

What you are looking for is a WFS-T service. OpenLayers does support WFS, WFS-T and is based on ajax request because of javascript ion of OL. The steps are as follows:

Setup the following:

  1. PostgreSQL / PostGIS.
  2. WFS server - (Geoserver,MapServer,tinyOWS).
  3. WFS Client ofcourse, openlayers

tinyOWS is small and easy A full tutorial from start can be found here

share|improve this answer
actually I can place ajax codes in commit function to save data without WFS-T, just want to learn the way openlayers does – lune Nov 23 '12 at 10:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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