The MapInfo color coding scheme is documented here:
http://georezo.net/jparis/MI_Enviro/Colors/color_models.htm#6-1%20R,G,B%20%3C%3E%20RGB

RGB = (65536 * R)  +  (256 * G)  +  B

With this formula, you should be able to get the R, G and B and
transform them to hex.

2011/10/30 Andrea Aime <andrea.a...@geo-solutions.it>:
> On Fri, Oct 28, 2011 at 2:12 PM, Andy Berry <andy.be...@wrexham.gov.uk> wrote:
>> I am trying to display lines with specific attributes contained in a  field
>>
>> The field (from Mapinfo) contains for example Pen(4, 2, 16711935)
>>
>> I will need to convert the 3rd number to a hex colour and the first to the
>> line thickness
>>
>> So far I have
>>
>>        <LineSymbolizer>
>>
>>                 <Stroke>
>>
>>                                 <CssParameter name="stroke">
>>
>>                                 #FF0000
>>
>>                                 </CssParameter>
>>
>>                                 <CssParameter name="stroke-width">
>>
>>                                 <ogc:Function name="strSubstring">
>>
>>
>> <ogc:PropertyName>MI_STYLE</ogc:PropertyName>
>>
>>
>> <ogc:Literal>5</ogc:Literal>
>>
>>
>> <ogc:Function name="strIndexOf">
>>
>>
>>                 <ogc:PropertyName>MI_STYLE</ogc:PropertyName>
>>
>>
>> <ogc:Literal>,</ogc:Literal>
>>
>>
>> </ogc:Function>
>>
>>                                 </ogc:Function>
>>
>>                                 </CssParameter>
>>
>>                 </Stroke>
>>
>>        </LineSymbolizer>
>>
>> The difficulty is working out how to convert the number 1671168 to the hex
>> colour, in this case #FF0000. Has anyone done this before?
>
> I can't think of a good way to do that with the current toolset.
> I guess one would need some new filter functions that can do the parsing you
> need, that at the moment requires some java programming (we have been talking
> about having some scripting ability for a while, but so far nothing is
> evolved enough
> to ship with GeoServer, even if just as an extension)
>
> Cheers
> Andrea
>
> --
> -------------------------------------------------------
> Ing. Andrea Aime
> GeoSolutions S.A.S.
> Tech lead
>
> Via Poggio alle Viti 1187
> 55054  Massarosa (LU)
> Italy
>
> phone: +39 0584 962313
> fax:      +39 0584 962313
>
> http://www.geo-solutions.it
> http://geo-solutions.blogspot.com/
> http://www.youtube.com/user/GeoSolutionsIT
> http://www.linkedin.com/in/andreaaime
> http://twitter.com/geowolf
>
> -------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Get your Android app more play: Bring it to the BlackBerry PlayBook
> in minutes. BlackBerry App World&#153; now supports Android&#153; Apps
> for the BlackBerry&reg; PlayBook&#153;. Discover just how easy and simple
> it is! http://p.sf.net/sfu/android-dev2dev
> _______________________________________________
> Geoserver-users mailing list
> Geoserver-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>

------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook 
in minutes. BlackBerry App World&#153; now supports Android&#153; Apps 
for the BlackBerry&reg; PlayBook&#153;. Discover just how easy and simple 
it is! http://p.sf.net/sfu/android-dev2dev
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to