[mapserver-users] Re: from kml styles to mapserver layer classification

Mr. Puneet Kishor punk.kish at gmail.com
Mon Feb 20 20:06:17 PST 2012


Mike (and Richard),

Thanks for the advice, but I didn't have to use gdal. As I wrote in another email, 5 or so lines of Perl code extracted the hex color values and inserted them in the Postgres table. From there, it was just a matter of knowing the correct map file syntax. Richard's suggestion of prefixing the # sign was spot on, which I added right in the Pg column. Then, the CLASS STYLE shown below worked really well.

Many thanks all.


On Feb 20, 2012, at 9:27 PM, Smith, Michael ERDC-CRREL-NH wrote:

> Puneet,
> 
> A very recent version of gdal, last couple of weeks, can convert KML
> styles into OGR style strings. MapServer can use those OGR Style strings
> with the AUTO style option.
> 
> Mike
> 
> -- 
> Michael Smith
> 
> US Army Corps
> Remote Sensing GIS/Center
> 
> 
> 
> On 2/20/12 10:23 PM, "Mr. Puneet Kishor" <punk.kish at gmail.com> wrote:
> 
>> Hi Richard,
>> 
>> On Feb 20, 2012, at 9:21 PM, Richard Greenwood wrote:
>> 
>>> On Mon, Feb 20, 2012 at 8:05 PM, Mr. Puneet Kishor
>>> <punk.kish at gmail.com> wrote:
>>> 
>>>> How can I color the polys in the layer with the hex_color values?
>>> 
>>> COLOR "#ff0000"
>> 
>> 
>> 
>> So, I can use the hex values directly. Cool. But, will the following be
>> sufficient in the map file?
>> 
>>  LAYER
>>      NAME "foo"
>>      DATA "the_geom FROM (SELECT gid, hex_color, the_geom FROM t) tmp
>> USING UNIQUE gid USING srid=4326"
>>      STATUS ON
>>          TYPE POLYGON
>>          CLASS
>>              STYLE
>>                  COLOR [hex_color]
>>              END
>>          END
>> 	END
>>  END
>> 




More information about the MapServer-users mailing list