Mapserver problems

Sean Gillies sgillies at FRII.COM
Wed Dec 15 10:30:06 EST 2004


On Dec 15, 2004, at 1:28 AM, James Anderson wrote:

> Hi,
>
> I am using png format for output.
> Considering the input format is a png file with transparency, it
> should not
> matter what the output format is. The output does not need to have
> transparency.  It could be something like jpeg or bitmap or whatever,
> and it
> still should work correctly.
> I have included two sample maps rendered using the two different
> mapserver
> versions.
>
> Version 4.2.5 image is mapserv_4-2-5.png        This is the correct
> one.
> Version 4.4.0 image is mapserv_4-4.png            This is the one with
> the
> problem.
>
> I have also included my symbol file, mobileicon.png, which is a PNG
> file
> with transparency.  This you can verify with an image editing tool like
> Photoshop, Paint Shop Pro, Gimp, etc.
>
> I have not changed my input map file format between mapserver versions.
> Maybe I am missing something that version 4.4 needs ?
>
> Here is some code from my map file.
>
> OUTPUTFORMAT
>  NAME PNG
>  DRIVER 'GD/PNG'
>  MIMETYPE 'image/png'
>  EXTENSION PNG
>  IMAGEMODE RGB
> END
>
> Now this is making a plain 24bit png file with no transparency.  But
> there
> should not be a problem here as I dont need transparency in my output.
>  What
> I want is it to overlay my symbol file correctly.   In certain places
> in my
> project I pipe the output of mapserver into a Java applet.  Now java
> does
> not like png that well, so I then use JPEG format for output.  When
> using
> jpeg output I get the same results with 4.2.5 and 4.4 .. eg 4.2.5
> works, and
> 4.4 does not.
>
> Here is how I am specifying my symbol:
>
> SYMBOL
>    Name "mi83467696824027"
>    Type PIXMAP
>    Image "/home/maps/tempmap/mi83467696824027.png"
> END
>
> now the image file mi83467696824027.png is identical to the
> mobileicon.png
> image.  It just has another name in this case as its sucked out of
> database
> on the fly when I create the map file.
>
> My Script file makes a mif file with the lat/lon of where the symbol
> should
> be.
> I then make a layer using the symbol like this.
>
> LAYER
>    NAME "mobile_Layer"
>    TYPE point
>    CONNECTIONTYPE OGR
>    CONNECTION "/home/maps/tempmap/83467696824027.mif"
>    STATUS DEFAULT
>    CLASSITEM "Car"
>     CLASS
>      COLOR 0 0 0
>      SYMBOL "mi83467696824027"
>    END
> END
>
> Ok, now here you will see I specify the color to be 0 0 0 which is
> black.
> But if I remove this statement, the Symbol is not drawn at all on
> either
> version.  On 4.2.5 it accepts the transparency in the symbol image
> file.  In
> 4.4, it does not.  I have also found that on version 4.4, with some
> different symbol image files with transparency, the color is say green
> instead of black.  This seems to be because its ignoring the
> transparency
> and drawing the color in the color map thats supposed to be
> transparent.
> This I see as a problem.  Have they perhaps added some other
> statement/directive to go into the mapfile somewhere to solve this ??
> Or is
> this just a nasty bug in the newer version ??  I hope I have clearly
> explained my difficulties ??  Do any of you out there have any ideas ??
>
> Thanks and Regards,
>
> James Anderson.
>
>
>
>
>
> ----- Original Message -----
> From: "Sean Gillies" <sgillies at frii.com>
> To: "James Anderson" <james at DANISAT.NET>
> Cc: <MAPSERVER-USERS at LISTS.UMN.EDU>
> Sent: Monday, December 13, 2004 5:57 PM
> Subject: Re: Mapserver problems
>
>
> | On Dec 13, 2004, at 8:09 AM, James Anderson wrote:
> |
> | > This is a multi-part message in MIME format.
> | >
> | > ------=_NextPart_000_0047_01C4E136.7C4F1E60
> | > Content-Type: text/plain;
> | >         charset="Windows-1252"
> | > Content-Transfer-Encoding: quoted-printable
> | >
> | >
> | >
> | > Hi,
> | >
> | > After Upgrading from Mapserver 4.2.5
> | >
> | > MapServer version 4.2.5 OUTPUT=3DPNG OUTPUT=3DJPEG OUTPUT=3DWBMP =
> | > SUPPORTS=3DPROJ SUPPORTS=3DFREETYPE SUPPORTS=3DWMS_SERVER
> | > INPUT=3DEPPL7 =
> | > INPUT=3DOGR INPUT=3DGDAL INPUT=3DSHAPEFILE
> | >
> | >
> | > To Mapserver 4.4.0
> | > MapServer version 4.4.0 OUTPUT=3DPNG OUTPUT=3DJPEG OUTPUT=3DWBMP =
> | > SUPPORTS=3DPROJ SUPPORTS=3DFREETYPE SUPPORTS=3DWMS_SERVER
> | > INPUT=3DEPPL7 =
> | > INPUT=3DOGR INPUT=3DGDAL INPUT=3DSHAPEFILE
> | >
> | > I am having problems with symbols and transparency.
> | > I have been using transparent png files.  Since the upgrade the =
> | > transparent part of the symbols comes out all black.  This makes my
> | > map =
> | > look rather nasty.
> | >
> | > Does anyone have any idea whats changed in the newer mapserver
> version
> | > =
> | > that might cause this ?
> | >
> | > Any help appreciated.
> | >
> | > Thanks,
> | >
> | > James Anderson.
> | >
> |
> | James,
> |
> | You omitted what is probably the most important information we
> | need ... what output format are you using?  Do you define
> | transparency for the output?
> |
> | In many cases where a user reports that they have different
> | results between versions, it turns out that the user has changed
> | their *usage* between versions.  I'm not discounting your problem,
> | just want to make sure that you've absolutely ruled out that cause.
> |
> | Sean
> |

If you want a symbol rendered with transparency onto a RGB map,
you need to define

     TRANSPARENCY ALPHA

for that layer.  I added this to 4.2.4 to fix a long-standing
bug.

I also saw that you are not defining the symbol properly for your
class.  Please read the current mapfile reference documentation.
Your usage is out of date.  You should do something like this:

     LAYER
       CLASS
         STYLE
           SYMBOL "mi83467696824027"
         END
       END
     END

There are examples for each of these cases in
mapserver/tests/test.map in the MapServer distribution.

Sean

--
Sean Gillies
sgillies at frii dot com
http://users.frii.com/sgillies



More information about the mapserver-users mailing list