[mapserver-users] creating a dynamic thematic map based on attribs in a Pg table

Mr. Puneet Kishor punk.kish at gmail.com
Wed Aug 24 09:14:25 PDT 2011


I need a tute (or a pointer to one online) on how to color polys in a thematic map based on values retrieved from a separate table. I have

table a
-------
gid
attrib_id
the_geom

table b
-------
attrib_id
attrib_name
color_rgb (values such as "242 242 33" and "255 255 0")

I would like to have MS color the polys and name the layers, ideally without having to create the CLASS definitions for each of the 80+ attribs, something akin to

    LAYER
        NAME "my layer"
        STATUS ON
        TYPE POLYGON
        CONNECTIONTYPE POSTGIS
        ..
        DATA "the_geom FROM (SELECT gid, the_geom, attrib_name, color_rgb FROM a JOIN b ON a.attrib_id = b.attrib_id) view USING UNIQUE gid"

        CLASS
            NAME       [attrib_name]
            STYLE
                COLOR        [color_rgb]
                OUTLINECOLOR 0 0 0
            END
        END
    END

How do I accomplish something like above?


More information about the MapServer-users mailing list