[GIS] OpenLayers: how to save added point in server side

openlayers-2point

  • 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?

Best Answer

I found a cool sample that illustrates the handling. Take a look at this (the source code :-D) http://edgemaster.dev.openstreetmap.org/oldemo/10.htm

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
});
map.addLayer(scribble);
Related Question