[Cartoweb-users] edit geometry and insert data with select element

Oliver Christen oliver.christen at camptocamp.com
Thu Jun 5 08:23:58 EDT 2008


Hi

maybe you can do that by modyfing a bit the edit plugin
see http://www.cartoweb.org/cwiki/HowToAddDropdownInEditPlugin for using dropdown
since the content of the dropdown comes from other tables, you must find a way to get these values when the edit plugin is used
maybe an easy way would be to do a join directly in the layer data's sql so you would have all the fields at once and it would be transparent for the edit plugin

regards
Oliver

  From: Giovanni Virdis 
  To: cartoweb-users at lists.maptools.org 
  Sent: Thursday, June 05, 2008 1:54 PM
  Subject: [Cartoweb-users] edit geometry and insert data with select element


  Hi I have a problem can someone help me?

   

  This is my problem

   

  I have three table:

   

  ppc_funuso 

    a.. id_funuso à primary key (numeric) 
    b.. ds_funuso 
    c..   
  ppc_tipesposti

    a.. id_tipesposti à primary key (varchar(3)) 
    b.. fun_id_funuso à primary key  and foreign key of ppc_funuso 
    c.. ds_tipesposti 
   

  ppc_esposti

    a.. id_esposto à primary key 
    b.. ds_esposto 
    c.. geometria à geometry 
    d.. tpe_id_tipesposti + tpe_fun_id_funuso à foreign key of  ppc_tipesposti 
    e.. ubicazione 
    f.. n_civico 
    g.. rectal 
    h.. popolazione 
    i.. non_autosuf 
    j.. num_nonautosuf 
    k.. note 
   

  I have create a layer in my .map file:

   

    LAYER

      NAME "Esposti_PPC"

      STATUS ON

      TYPE POLYGON

      CONNECTIONTYPE POSTGIS

      CONNECTION 'dbname=iwork_ppc user=iwork_ppc password=colapasta host=10.0.0.3'

      DATA 'geometria from (select geometria, oid, id_esposto, ds_esposto, ubicazione, n_civico, rectel, popolazione, 

                            non_autosuf, num_nonautosuf, note, tpe_fun_id_funuso, tpe_id_tipesposti 

                            from ppc_esposti) as foo using unique "id_esposto" using srid=-1'

      TEMPLATE 'ttt'

      TRANSPARENCY 50

      LABELITEM "ds_esposto"

      CLASS

        NAME "class"

        STYLE

          COLOR 50 50 255

          OUTLINECOLOR 255 50 50

        END

        LABEL

          TYPE TRUETYPE

          FONT "Vera"

          SIZE 7

          COLOR 0 0 0

          POSITION cc

          BACKGROUNDCOLOR 245 235 235

          BACKGROUNDSHADOWCOLOR 55 55 55

          BACKGROUNDSHADOWSIZE 1 1

        END

      END

      LABELMAXSCALE 50000

      METADATA

        'id_attribute_string' 'id_esposto' # query

        'query_returned_attributes' 'ds_esposto, ubicazione, n_civico, rectel, popolazione, 

                                     non_autosuf, num_nonautosuf, note, tpe_fun_id_funuso, tpe_id_tipesposti'

        'edit_table' 'ppc_esposti' # PostGIS table

        'edit_geometry_column' 'geometria' # PostGIS geometry column

        'edit_geometry_type' 'polygon' # PostGIS geometry type

        'edit_srid' '-1'

        'edit_attributes' 'id_esposto,ds_esposto|string,ubicazione|string,n_civico|string,rectel|string,popolazione|integer, 

                            non_autosuf|string, num_nonautosuf|integer, note|string, tpe_fun_id_funuso|integer, tpe_id_tipesposti|string' # list of the editable fields

        'edit_filter' '' # mapserver filter

      END

    END

   

  If is possible when I edit a layer and draw a new geometry in the relative multirecord to insert the data I want a combobox (select in html) for insert a value of ppc_funuso and ppc_tipesposti

   

  ppc_funuso

   

        id_funuso
       ds_funuso
       
        0
       Strutture abitative private
       
        1
       Strutture per l'istruzione 
       

   

  ppc_tipesposti

   

   

        id_tipesposti
       fun_id_funuso
       ds_tipesposti
       
        01
       0
       Privato
       
        01
       1
       Nido
       
        02
       1
       Scuola materna
       
        99
       1
       Altro
       

   

   

  Example.

   

  I draw a new geometry for the selected layer , the system show  the filed to insert the data of the geometry instead to insert a value 0 and 01,02 etc.. for the field "tpe_fun_id_funuso, tpe_id_tipesposti" I select the label from select field and the system save in the table the relative value

   

   



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


  _______________________________________________
  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/20080605/114b633c/attachment-0001.html


More information about the Cartoweb-users mailing list