[Cartoweb-users] Changing State of Database

Roger Peruchet peruchet at gmail.com
Wed Feb 8 09:49:11 EST 2006


Thank you Pierre four your fast answer.

This is my label table:

   CREATE TABLE sector
   (
      gid int4 NOT NULL DEFAULT nextval('sector_gid_seq'::regclass),
      ___dummy varchar,
      the_geom geometry,
      *open int4 NOT NULL DEFAULT 0,*
      CONSTRAINT sector_pkey PRIMARY KEY (gid),
      CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2),
      CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) =
'MULTIPOLYGON'::text OR the_geom IS NULL),
      CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = -1)
    )
    WITHOUT OIDS;
    ALTER TABLE sector OWNER TO postgres;

but I only need to change the "open" variable. If I put one '0' it print the
shape red, and if '1' it prints green.
This is my part of .map that make this.

   LAYER
    NAME "sector140"
    CONNECTIONTYPE postgis
    CONNECTION "user=postgres password=postgres dbname=prova host=
10.56.0.195 port=5432"
    DATA "the_geom from sector"
    TYPE POLYGON
    TRANSPARENCY 50
    TEMPLATE "ttt"
    CLASSITEM "open"
    CLASS
 NAME "opened"
 EXPRESSION "1"
      STYLE
       COLOR 0 255 0
       OUTLINECOLOR 255 180 180
      END
    END
   CLASS
 NAME "closed"
      EXPRESSION "0"
      STYLE
       COLOR 255 0 0
       OUTLINECOLOR 255 180 180
      END
    END

It works, but Can anyone help me to make the plugin for change the variable
in Database? I never write a plugin yet :(

Many thanks.



> I can change the colour of the shapes through changing one variable in
> my databse.

How do you do that ? Directly in your mapfile using a field value in
your database ?

> But can I change this variable in Cartoweb interface? and if the
> answer is yes how?

This could be the job of a new plugin in your project.
On client side, this would add a form button on the interface and handle
it to send a specific request to the server side.
On server side, this would call the mapOverlay plugin to change the
style of the defined layer.

>
> I don't know if I explained. I need change the colour of the shapes
> through buttons in the same interface.
>
> Many thanks.
>
>------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20060208/ec782033/attachment.html


More information about the Cartoweb-users mailing list