[mapserver-users] Re: from kml styles to mapserver layer classification
Mr. Puneet Kishor
punk.kish at gmail.com
Mon Feb 20 19:05:22 PST 2012
On Feb 20, 2012, at 4:44 PM, Puneet Kishor wrote:
> I have a kml with a bunch of styles to color polygons. Is there a quick/easy way to extract them and convert them to MapServer layer classification rules?
>
the above actually turned out to be a lot easier than I thought... about 4 lines of Perl.
Now, I have a table with geometry, and colors for each feature.
CREATE TABLE t (attr, hex_color, the_geom);
How can I color the polys in the layer with the hex_color values? Looking at the map file docs, I came up with something like so
LAYER
NAME "foo"
DATA "the_geom FROM (SELECT gid, rgb(hex_color) AS rgb_color, the_geom FROM t) tmp USING UNIQUE gid USING srid=4326"
STATUS ON
TYPE POLYGON
CLASS
STYLE
COLOR [rgb_color]
OUTLINECOLOR 68 68 68
END
END
END
END
where rgb() converts "hex_color" to a string of RGB triplets. So, "000000" becomes "0 0 0".
Is the above correct? For now, it doesn't seem to be working for me.
Many tia,
--
Puneet Kishor
More information about the MapServer-users
mailing list