Mapserver Color Binding: Blue and Green swapped (bug?)

Milo van der Linden mlinden at ZEELANDNET.NL
Wed Oct 31 22:49:21 PDT 2007


Extra note:

MapInfo uses a large integer to describe it's internaly used colors. 
Here is a C# function to convert MapInfo color code to RGB: as you can 
see, the MapInfo color code is in format BGR instead of RGB.

Maybe this has to do with your problem?


 private static Color miColorCodeToRGB(Int32 miColorCode)
    {
        Int32 iRed;
        Int32 iGreen;
        Int32 iBlue;
        Int32 _miColorCode;

        try
        {
        _miColorCode = miColorCode;

        //lColor = lColor \ &H100  'divide
        //iGreen = lColor Mod &H100 'get green component

        iRed = _miColorCode % 0x100;
        _miColorCode = _miColorCode / 0x100;
        iGreen = _miColorCode % 0x100;
        _miColorCode = _miColorCode / 0x100;
        iBlue = _miColorCode % 0x100;

            Color _Color = Color.FromArgb(255,iBlue, iGreen, iRed);
           
            return _Color;
        }
        catch
        {
            return Color.Transparent;
        }

Frank Warmerdam schreef:
> Delfos, Jacob wrote:
>> Hi List
>>
>> I am trying to make use of the colour binding feature, and it 
>> basically works, except... the colours are not quite right. My 
>> colours do not match those in MapInfo, although I can make MapInfo 
>> emulate the MapServer colours by swapping blue and green around. So 
>> basically: my RGB values are interpreted by MapServer as RBG.
>>
>> This happens for polygons as well as lines (haven't tried points). My 
>> data has been translated from MapInfo to PostGIS.
>>
>> I tried to lodge a bug in Trac, but it says "TICKET_CREATE privileges 
>> are required to perform this operation"
>>
>> Does anyone know more about this colour problem?
>
> Jacob,
>
> With some pointers from Howard, I found this segment of code in
> bindColorAttribute() in maputil.c:
>
>     attribute->red = atoi(tokens[0]);
>     attribute->blue = atoi(tokens[1]);
>     attribute->green = atoi(tokens[2]);
>
>
> I think this is responsible.  If you are building from source, try just
> changing it to the more obvious organization.  I'd also suggest you
> file a bug in Trac on the issue we will see if there is a subtle reason
> for this, or it's just a typo.
>
> To file bugs you need an OSGeo Userid.  The pointer to get an osgeo
> userid which you can use to login with is under the title "Important
> Notice" on the http://trac.osgeo.org/mapserver page.  The same userid
> can be used for other OSGeo services like subversion, and other
> trac instances (like GDAL's).
>
> Best regards,


-- 


	

Milo van der Linden
skype: milovanderlinden <skype:milovanderlinden?add>
mlinden at zeelandnet.nl <mailto:mlinden at zeelandnet.nl>
milovanderlinden at gmail.com <mailto:milovanderlinden at gmail.com>
milo at 3dsite.nl <mailto:milo at 3dsite.nl>
http://www.3dsite.nl

	  	

De informatie in dit bericht reflecteert mijn persoonlijke mening en 
niet die van een bedrijf of instantie. Aan de informatie kunnen geen 
rechten worden ontleend. Indien dit bericht onderdeel is van een forum, 
mailing-list of community dan gelden automatisch de bij het betreffende 
medium behorende voorwaarden. The information in this message reflects 
my personal opinion and not that of a company or public body. All rights 
reserved.If this message is contained in a mailing-list or community, 
the rights on the medium are automatically adapted.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20071101/b2af3c66/attachment.htm>


More information about the MapServer-users mailing list