Edit vectorial layers

How does it work in other products

GeoMapFish

In the frontend

You can find a demo here (user: demo, password: demo). The analysis below is based on this demo and the network requests done while testing it.

The layers are write protected and the user must login with a username and a password. After the authentication is done, cookies are created and send to the server for each requests.

Note

According to the documentation it is possible to copy an object from a layer to another if both layers have the same geometry.

Object Creation

To create a new object, the user must choose the type (polygon, line or point) and than draw on the map. When the drawing is done, the user can save it by clicking on the save button. The object is then saved on the server like this:

  1. POST request to a URL like /layers/<id-layers>. The cookies are transmitted. The request contains the drawing in the GeoJSON format. The server answers with the same GeoJSON with one key difference: the new object contains an id so the user can edit it.
  2. The layer is asked again to MapServer.
  3. This display of the layer is updated.
../_images/geomapfish_create.png

The dialog to create an object with GeoMapFish

Object Edition

To edit an object, the user need to click on it. Once this is done, the object switch to “edition mode”. The user can then modify it and the modifications are displayed over the original object with a lighter color (see screenshot below). Once the editing is done, the user must click on the save button. The object is then stored like this:

  1. POST request to a URL like /layers/<id-layers>/<id-object>. The cookies are transmitted. The request contains the drawing in the GeoJSON format. The server answers with the same GeoJSON.
  2. The layer is asked again to MapServer.
  3. This display of the layer is updated.
../_images/geomapfish_edit.png

The dialog to edit an object with GeoMapFish

The edition tools contains some advanced features like the possibility to subtract polygons.

Object Deletion

To delete an object, the user must click on the object and then select Actions > Delete. The deletion occurs like this:

  1. DELETE request to a URL like /layers/<id-layers>/<id-object>. The cookies are transmitted.
  2. The layer is asked again to MapServer.
  3. This display of the layer is updated.

In the backend

According to the documentation, GeoMapFish will act as a proxy between the user and TinyOWS in order to check that the user is authenticated and has the right to edit this layer.

The edition feature is more detailed on this page. To be editable, a layer must:

  • Be accessible in WMS.
  • Be associated with a PostGIS table. This table must have a primary key that is incremented automatically when a data is inserted into it (SERIAL or another type with a sequence).
  • Be protected: only the users that can edit it must be able to edit it.

There must also be a mapping between the layer and the table (something like what we do with features requests).

QGis Server

3liz has a demo of layer edition. It relies on QGis Server and OpenLayers 2 through lizmap. QGis Server is configured as a WFS-T server and OpenLayers do the proper WFS requests when the user save his/her editions.