[Mapbender-users] MB 2.5: Problems with legends in pdf-print using mapserver's agg

Michael Schulz mschulz at webgis.de
Wed Apr 29 09:55:39 EDT 2009


Hi Herbert,

the cause for this behaviour is the php class that is called from the
print module to weld together the single wms images
(classes/class_weldmaps2png.php). This modules changes the imageformat
always to "image/png". To overcome this problem, my way to go is to
have mapserver expose the 24bit outputformat as "image/png" - and not
as "image/png; mode=24bit".

And sorry, because i can reproduce your problem now. When looking
through this I was missing the "transparent on" in the legend
section... So, I am not sure if there is a solution to the problem
with your current settings.

Mapserver docs state that the use of the transparent keyword in legend
is deprecated in favor of using the transparency of the outputformat.
There transparent is not to be used in conjunction with RGB images. If
using imagemode RGBA it should render all elements on an initially
transparent background, which seems not to be true (I get back a black
background). Maybe a Mapserver bug.

Do you really need the transparent legend? it cannot be white? That's
the only solution at the moment i guess:
- remove transparent on from legend
- use MIMETYPE 'image/png', since then you'll get the 24bit output
with imageformat/png.

Not really helpful, I know. Maybe you can give it a try.

Cheers, Michael


Am 29. April 2009 14:56 schrieb Schönhammer, Herbert
<Schoenhammer.Herbert at regensburg.de>:
> Hi Michael,
> Hi list,
>
> I'm back again with (nearly) the same problem ;-)
>
> Now I've got a server, reachable from Internet. I wanted to build a gui for testing the troubles. But with some further trial and error I found a combination of mapserver/agg-parameters and mapbender-parameters which are avoiding the described problem.
>
> But now I have another problem in printing the map (please see below !)
>
> First things, which are doing right now:
>
> In my MAPFILE I'm using now:
> ---------------------------
> # 24 Bit Farbe
> OUTPUTFORMAT
>  NAME 'AGGA'
>  #MIMETYPE 'image/png'             <======= you MUST NOT use the MIMETYPE attribute !!!!
>  DRIVER AGG/PNG
>  EXTENSION PNG
>  IMAGEMODE RGBA
> END
>
> LEGEND
>  STATUS ON
>  KEYSIZE 30 20
>  KEYSPACING 10 5
>    LABEL
>     COLOR 0 0 0
>     TYPE TRUETYPE
>     FONT "verdana"
>     SIZE 8
>    END
>  TRANSPARENT ON
>  IMAGECOLOR 255 255 255
> END
>
>
> In mapbender wms-gui settings I use:
> -------------------------------------
> "image/png; mode=24bit" for this wms
>
>
> The result is
> --------------
> I have a map with good quality ON THE SCREEN, the legend ON THE SCREEN is okay (has transparent background)
> AND THE LEGEND ON THE PRINT IS OKAY NOW (the legend has also a transparent background).
>
>
> The new problem is:
> -------------------
> Now the quality in the MAP of the print is poor. It seems, that the print-module is ignoring the mapbender-setting "image/png; mode=24bit".
>
> In detail:
>
> In mb_log the following request is logged as request for printing (I have replaced ' ' through '%20' because the server is online; you may try the requests !!):
> http://stadtplan2.regensburg.de/cgi-bin/getows?map=/cityportal-maps/rgb_printtest-agg24.map&VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&LAYERS=strassenachsen&STYLES=&SRS=EPSG:31468&BBOX=4506700.1038532015,5431380.99999632,4506868.999796765,5431617.833858754&WIDTH=1780&HEIGHT=2496&FORMAT=image/png;%20mode=24bit&BGCOLOR=0xffffff&TRANSPARENT=TRUE&EXCEPTIONS=application/vnd.ogc.se_inimage
>
> The request above delivers the correct image with good quality in 24bit color.
>
>
>
> But in webservers-log all requests for printing DO NOT use the "image/png; mode=24bit". They only use "image/png". The corresponding line in apache-log is:
> 192.168.2.16 - - [29/Apr/2009:14:03:13 +0200] "GET /cgi-bin/getows?map=/cityportal-maps/rgb_printtest-agg24.map&VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&LAYERS=strassenachsen&STYLES=&SRS=EPSG:31468&BBOX=4506700.1038532015,5431380.99999632,4506868.999796765,5431617.833858754&WIDTH=1780&HEIGHT=2496&FORMAT=image/png&BGCOLOR=0xffffff&TRANSPARENT=TRUE&EXCEPTIONS=application/vnd.ogc.se_inimage HTTP/1.0" 200 37121 "-" "-"
>
> for trying: http://stadtplan2.regensburg.de/cgi-bin/getows?map=/cityportal-maps/rgb_printtest-agg24.map&VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&LAYERS=strassenachsen&STYLES=&SRS=EPSG:31468&BBOX=4506700.1038532015,5431380.99999632,4506868.999796765,5431617.833858754&WIDTH=1780&HEIGHT=2496&FORMAT=image/png&BGCOLOR=0xffffff&TRANSPARENT=TRUE&EXCEPTIONS=application/vnd.ogc.se_inimage
>
> The request above delivers poor quality in 8bit color, which is used for printing !!!
>
>
> Obviously the logged map-request in mb_log differs from the map-requests sent to the webserver  !?!?!
>
>
> Tipps for me ?
> --------------
> Does anybody know where
> - the map-requests for printing are created ?
> - the map-requests for logging are created ?
> - the getlegendgraphic-requests for printing are created ?
>
> How to ensure, that the mapbender settings for mapformat are also used for printing ?
>
> I'm using MB 2.5 !!
>
> (If you want to make your own trials, this gui is now online for testing:
> http://stadtplan2.regensburg.de/mb25/frames/login.php?name=stadtplan&password=stadtplan&mb_user_myGui=Printtest )
>
>
> Thanks a lot
> greetings
> Herbert
>
>
>
>
>
>
>
>
>>-----Ursprüngliche Nachricht-----
>>Von: mapbender_users-bounces at lists.osgeo.org
>>[mailto:mapbender_users-bounces at lists.osgeo.org] Im Auftrag
>>von Michael Schulz
>>Gesendet: Dienstag, 3. März 2009 14:05
>>An: Mapbender User List
>>Betreff: Re: [Mapbender-users] MB 2.5: Problems with legends
>>in pdf-print using mapserver's agg
>>
>>
>>Hi Herbert,
>>
>>I am somewhat at the end of my latin ;-)
>>
>>class_SaveLegend should create a white background rectangle in each
>>created legend image. If I remember correctly your using the RGBA mode
>>in your outputformat. Could you try with only RGB? Maybe the pdf class
>>image functions cannot handle alpha channel transparency.
>>
>>Cheers, Michael
>>
>>
>>2009/3/3 Schönhammer, Herbert <Schoenhammer.Herbert at regensburg.de>:
>>> Hi Michael,
>>>
>>> (sorry today and tomorrow I have a lot of dates :-(, so i'm
>>late to answer ! )
>>>
>>> following your hints, I'm observing following:
>>>
>>> 1) I'm using again: image/png as wms setting
>>> 2) $unlink=false: The png -file of the legend-picture is a
>>24 bit picture with the wrong (=black) background-color
>>> 3) Looking at apache-log mapbender's
>>getlegendgraphic-request uses "image/png"
>>> 4) Taking the request from apache-log and sending this
>>request to mapserver: the picture comes with transparent
>>background (like it should be) as a 24 bit png !
>>>
>>> => The request from mapbender to mapserver has a correct 24
>>bit png as result
>>> => The temporary file in the tmp- directory is also a 24bit
>>png, but with wrong background color
>>> => This wrong (black) png is inc´luded into the generated pdf !
>>>
>>>
>>> P.S: I'm not able to give you access to the services. From
>>Internet they will be rechable next weak !
>>>
>>> regards
>>> Herbert
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>>-----Ursprüngliche Nachricht-----
>>>>Von: mapbender_users-bounces at lists.osgeo.org
>>>>[mailto:mapbender_users-bounces at lists.osgeo.org] Im Auftrag
>>>>von Michael Schulz
>>>>Gesendet: Montag, 2. März 2009 17:57
>>>>An: Mapbender User List
>>>>Betreff: Re: [Mapbender-users] MB 2.5: Problems with legends
>>>>in pdf-print using mapserver's agg
>>>>
>>>>
>>>>Hi,
>>>>
>>>>the problem with 24bit rendering is, that mapserver publishes that as
>>>>"image/png;mode=24bit" in the wms getcapabilities if you don't define
>>>>a special outputformat. So, when you have set image/png as
>>>>image-format in mapbender and you get a 24bit png back everything is
>>>>perfect.
>>>>
>>>>Have you tried setting $unlink=false in printPDF.conf and
>>then examine
>>>>the temporary images while generating the pdf output? I am not sure,
>>>>if this has impact on the legend images, but it could be worth a try.
>>>>
>>>>Cheers, Michael
>>>>
>>>>
>>>>2009/3/2 Schönhammer, Herbert <Schoenhammer.Herbert at regensburg.de>:
>>>>> Hi Michael,
>>>>>
>>>>> sorry I don't really understand your hint :-(
>>>>>
>>>>> At the moment I use (wms-gui-settings): "image/png"
>>>>>
>>>>> But there is no difference between "image/png" and
>>>>"image/png; mode=24bit".
>>>>>
>>>>> Only the settings in the mapfile determine the outputformat.
>>>>So the following always generates a 8bit output. In this case,
>>>>the printig of the picture in the legend is okay, but the
>>>>quality of the map is very very poor.
>>>>>
>>>>> # 8 Bit Farbe
>>>>> OUTPUTFORMAT
>>>>>    NAME 'AGG_Q'
>>>>>    DRIVER AGG/PNG
>>>>>    IMAGEMODE RGB
>>>>>    FORMATOPTION "QUANTIZE_FORCE=ON"
>>>>>    FORMATOPTION "QUANTIZE_DITHER=OFF"
>>>>>    FORMATOPTION "QUANTIZE_COLORS=256"
>>>>> END
>>>>>
>>>>> So I want a map with 24bit color.
>>>>>
>>>>> Please: Could you give me some more hints?
>>>>>
>>>>> What shall I use ? "image/png" or "image/png; mode=24bit" in
>>>>wms-settings?
>>>>> What settings in the mapfile should be done in this case ?
>>>>>
>>>>> regards
>>>>> Herbert Schönhammer
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>-----Ursprüngliche Nachricht-----
>>>>>>Von: mapbender_users-bounces at lists.osgeo.org
>>>>>>[mailto:mapbender_users-bounces at lists.osgeo.org] Im Auftrag
>>>>>>von Michael Schulz
>>>>>>Gesendet: Montag, 2. März 2009 14:39
>>>>>>An: Mapbender User List
>>>>>>Betreff: Re: [Mapbender-users] MB 2.5: Problems with legends
>>>>>>in pdf-print using mapserver's agg
>>>>>>
>>>>>>
>>>>>>Hello Mr. Schönhammer,
>>>>>>
>>>>>>are you using imagemode "image/png;24bit mode" for this service in
>>>>>>Mapbender? Then this could be the problem, because
>>printPDF sets the
>>>>>>imageformat for the maps and the legend icons to image/png.
>>>>Then maybe
>>>>>>your customized outputformat isn't used anymore... In the GUI the
>>>>>>imageformats are used as defined in gui wms settings.
>>>>>>
>>>>>>Chees, Michael Schulz
>>>>>>
>>>>>>
>>>>>>
>>>>>>2009/3/2 Schönhammer, Herbert <Schoenhammer.Herbert at regensburg.de>:
>>>>>>> Hi list,
>>>>>>>
>>>>>>> I have a new strange problem with pdf-print in Mapbender 2.5.
>>>>>>>
>>>>>>> Lines should be rendered with rounded linejoins. So I'm
>>>>>>using mapserver agg
>>>>>>> - renderer with an outputformat defined like:
>>>>>>>
>>>>>>> OUTPUTFORMAT
>>>>>>>    ##NAME png
>>>>>>>    ##DRIVER "GD/PNG"
>>>>>>>    MIMETYPE "image/png"
>>>>>>>    NAME 'AGGA'
>>>>>>>    DRIVER AGG/PNG
>>>>>>>    EXTENSION PNG
>>>>>>>    IMAGEMODE RGBA
>>>>>>>    TRANSPARENT ON
>>>>>>> END
>>>>>>>
>>>>>>>
>>>>>>> Things are done well
>>>>>>>
>>>>>>> in the map
>>>>>>> and in the legend of the gui.
>>>>>>>
>>>>>>>
>>>>>>> Things are going wrong in printing the legend in pdf-print.
>>>>>>> The legend picture is drawn with a black background. So the
>>>>>>text of the
>>>>>>> legend is not readable anymore. (Please see examples in
>>>>the appendix)
>>>>>>>
>>>>>>>
>>>>>>> Until now I used gd-driver. With gd-driver all things are
>>>>>>going right.
>>>>>>>
>>>>>>> The background of the legend picture is defined transparent.
>>>>>>So the same
>>>>>>> legend picture my be used in different guis (with different
>>>>>>> background-color) and in pdf-Print.
>>>>>>>
>>>>>>> LEGEND
>>>>>>>   STATUS ON
>>>>>>>   KEYSIZE 298 398
>>>>>>>   KEYSPACING 10 1
>>>>>>>   LABEL
>>>>>>>     TYPE TRUETYPE
>>>>>>>     FONT "verdana"
>>>>>>>     SIZE 8
>>>>>>>     POSITION lc
>>>>>>>   END # END LABEL
>>>>>>>   TRANSPARENT ON
>>>>>>>   IMAGECOLOR 255 255 255
>>>>>>> END   #LEGEND
>>>>>>>
>>>>>>> I'm not able to detect any difference in the pictures
>>>>>>produced by gd or by
>>>>>>> agg. In all tools (even photo-editors) the background is
>>displayed
>>>>>>> transparent. Only in mapbender pdf-print the background is
>>>>>>displayed in
>>>>>>> black. So I think, the solution could be in pdf-print ?
>>>>>>>
>>>>>>> Has anybody observed similar problems ?
>>>>>>> Has anybody a tipp ?
>>>>>>>
>>>>>>> Thanks a lot
>>>>>>> Herbert Schönhammer
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Mapbender_users mailing list
>>>>>>> Mapbender_users at lists.osgeo.org
>>>>>>> http://lists.osgeo.org/mailman/listinfo/mapbender_users
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>--
>>>>>>-----------------------------------------------------------
>>>>>>Michael Schulz
>>>>>>mschulz at webgis.de
>>>>>>
>>>>>>in medias res
>>>>>>Gesellschaft für Informationstechnologie mbH
>>>>>>
>>>>>>In den Weihermatten 66
>>>>>>79108 Freiburg
>>>>>>
>>>>>>Tel  +49 (0)761 556959-5
>>>>>>Fax +49 (0)761 556959-6
>>>>>>
>>>>>>http://www.webgis.de / http://www.zopecms.de
>>>>>>-----------------------------------------------------------
>>>>>>Geschäftsführer: Stefan Giese, Dr. Christof Lindenbeck
>>>>>>Eingetragen im Handelsregister HRB 5930 beim Amtsgericht Freiburg
>>>>>>_______________________________________________
>>>>>>Mapbender_users mailing list
>>>>>>Mapbender_users at lists.osgeo.org
>>>>>>http://lists.osgeo.org/mailman/listinfo/mapbender_users
>>>>>>
>>>>> _______________________________________________
>>>>> Mapbender_users mailing list
>>>>> Mapbender_users at lists.osgeo.org
>>>>> http://lists.osgeo.org/mailman/listinfo/mapbender_users
>>>>>
>>>>
>>>>
>>>>
>>>>--
>>>>-----------------------------------------------------------
>>>>Michael Schulz
>>>>mschulz at webgis.de
>>>>
>>>>in medias res
>>>>Gesellschaft für Informationstechnologie mbH
>>>>
>>>>In den Weihermatten 66
>>>>79108 Freiburg
>>>>
>>>>Tel  +49 (0)761 556959-5
>>>>Fax +49 (0)761 556959-6
>>>>
>>>>http://www.webgis.de / http://www.zopecms.de
>>>>-----------------------------------------------------------
>>>>Geschäftsführer: Stefan Giese, Dr. Christof Lindenbeck
>>>>Eingetragen im Handelsregister HRB 5930 beim Amtsgericht Freiburg
>>>>_______________________________________________
>>>>Mapbender_users mailing list
>>>>Mapbender_users at lists.osgeo.org
>>>>http://lists.osgeo.org/mailman/listinfo/mapbender_users
>>>>
>>> _______________________________________________
>>> Mapbender_users mailing list
>>> Mapbender_users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapbender_users
>>>
>>
>>
>>
>>--
>>-----------------------------------------------------------
>>Michael Schulz
>>mschulz at webgis.de
>>
>>in medias res
>>Gesellschaft für Informationstechnologie mbH
>>
>>In den Weihermatten 66
>>79108 Freiburg
>>
>>Tel  +49 (0)761 556959-5
>>Fax +49 (0)761 556959-6
>>
>>http://www.webgis.de / http://www.zopecms.de
>>-----------------------------------------------------------
>>Geschäftsführer: Stefan Giese, Dr. Christof Lindenbeck
>>Eingetragen im Handelsregister HRB 5930 beim Amtsgericht Freiburg
>>_______________________________________________
>>Mapbender_users mailing list
>>Mapbender_users at lists.osgeo.org
>>http://lists.osgeo.org/mailman/listinfo/mapbender_users
>>
> _______________________________________________
> Mapbender_users mailing list
> Mapbender_users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapbender_users
>



-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Aufwind durch Wissen!

Qualifizierte Open Source Schulungen bei der
http://www.foss-akademie.de/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-----------------------------------------------------------
Michael Schulz
mschulz at webgis.de

in medias res
Gesellschaft für Informationstechnologie mbH

+++ Bitte beachten Sie unsere neue Adresse und Durchwahl +++

Schwimmbadstraße 2
D-79100  Freiburg i. Br.

Tel:  +49 (0)761 705798-102
Tel:  +49 (0)761 705798-0
Fax: +49 (0)761 705798-09

+++ Bitte beachten Sie unsere neue Adresse und Durchwahl +++

http://www.webgis.de / http://www.zopecms.de
--------------------------------------------------------------
Geschäftsführer: Stefan Giese, Dr. Christof Lindenbeck
Eingetragen im Handelsregister HRB 5930 beim Amtsgericht Freiburg


More information about the Mapbender_users mailing list