[Cartoweb-users] edit plugin edition of the attributes

Oliver Christen oliver.christen at camptocamp.com
Tue Aug 5 09:02:03 EDT 2008


Hi

the edit plugin do not use the DATA string to generate the sql for select/insert/update/delete, it use the various 'edit_*' parameters.
the sql itself is generated in file ServerEdit.php.
you need to extend the server part of the edit plugin if you want to modify the way the sql is generated so you can get and modify the data from different tables.
see http://www.cartoweb.org/doc_head/docbook/xhtml/dev.newplugin.html#dev.newplugin.adapting.extending (sound complicated but it's fairly simple)

another possbility would be to use a postgres "view" containing the aggregated data of the different tables. The only problem is by default a "view" is readonly, though the postgres documentation say it is possible to add "rules" on the "view" to generate the corresponding action on the parent tables. 
I havent tried that myself.

regards
Oliver

  ----- Original Message ----- 
  From: Claire Chastagnol 
  To: cartoweb-users at lists.maptools.org 
  Sent: Tuesday, August 05, 2008 2:48 PM
  Subject: [Cartoweb-users] edit plugin edition of the attributes


  Hi,

  I have a little question on the edit plugin.
  My layer to edit is part of a database. I would like to edit some attributes wich are part of other tables (non geographic) while I'm editing my geographic layer.
  Is this possible?

  I tried with a query in the mapfile  which join the tables, but I can't edit the attributes which aren't in the table corresponding to the layer I am editing.

  This is my mapfile:
  LAYER
      NAME "evenements"
      TYPE POINT
      STATUS ON
      TEMPLATE 'ttt'
      CONNECTIONTYPE POSTGIS
      CONNECTION 'dbname=crises_route user=myuser password=mypassword host=localhost'
      DATA "geo FROM (SELECT geo,evenements.id_ev,type_ev FROM evenements JOIN type_ev ON evenements.id_ev = type_ev.id_type_ev) as foo USING UNIQUE id_ev USING SRID = 27573"     
      
      CLASS
          NAME "inondation"
          STYLE
              COLOR 204 51 204
          END
          
      END
      
      METADATA
          'id_attribute_string' 'evenements.id_ev'    
          'query_returned_attributes' 'evenements.id_ev type_ev description'
          'edit_table' 'evenements' # PostGIS table
          'edit_geometry_column' 'geo' # PostGIS geometry column
          'edit_geometry_type' 'point' # PostGIS geometry type
          'edit_srid' '27573'
          'edit_attributes' 'evenements.id_ev,type_ev|string,description|string' # list of the editable 
          
      END

   also tried the query: DATA "geo FROM (SELECT geo,evenements.id_ev,type_ev FROM evenements, type_ev WHERE evenements.id_ev = type_ev.id_type_ev) as foo USING UNIQUE id_ev USING SRID = 27573"
  But this creates an error message which says:


Postgresql reports the error as 'ERREUR:  find_srid() - couldnt find the corresponding SRID - is the geometry registered in the GEOMETRY_COLUMNS table?  Is there an uppercase/lowercase missmatch?But my SRID is the same in my mapfile and my database!!!

  Thank you for the help.
  Claire




------------------------------------------------------------------------------


  _______________________________________________
  Cartoweb-users mailing list
  Cartoweb-users at lists.maptools.org
  http://lists.maptools.org/mailman/listinfo/cartoweb-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20080805/f80d7c63/attachment.html


More information about the Cartoweb-users mailing list