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

Michael Schulz mschulz at webgis.de
Thu Apr 30 03:39:18 EDT 2009


Hi Herbert,

as Armin pointed out, the problem with "image/png; mode=24bit" is that
the connector has problems with the url encoding.

If the 24bit legend with transparent background is turns black in the
pdf although it arrives ;-) with a transparent background, then sth.
is going wrong in class_saveLegend. But it basically uses the same
procedure to generate the legend image as weld2maps does... I'll try
look into this.

Cheers, Michael


Am 30. April 2009 08:44 schrieb Schönhammer, Herbert
<Schoenhammer.Herbert at regensburg.de>:
> Hi Armin,
>
> I made some tests: Using
>        $output = $this->set("format","image/png; mode=24bit");
> instead of
>        $output = $this->set("format","image/png");
>
> I get this result:
> - the legend is okay
> - but he mapframe of the print is only white; no error message
>
> I give up;
> I will switch the background of the legend-module in all gui's to white;
> => the legend-background of mapserver's legend could also be white
> => the print is okay
>
> => but the appearance of all guis is not okay :-(
>
> But the better map-quality offered by agg should be a reason for doing that !
>
> Thanks to all, which gave me some hints for troubleshooting.
>
> regards
> Herbert
>
> P:S: I will close the "Printtest"-gui in a few days.
>
>
>
>>-----Ursprüngliche Nachricht-----
>>Von: mapbender_users-bounces at lists.osgeo.org
>>[mailto:mapbender_users-bounces at lists.osgeo.org] Im Auftrag
>>von Armin Retterath
>>Gesendet: Mittwoch, 29. April 2009 16:13
>>An: Mapbender User List
>>Betreff: Re: AW: [Mapbender-users] MB 2.5: Problems with
>>legends in pdf-print using mapserver's agg
>>
>>
>>hello herbert,
>>i think, that mb_log logs only the requests, that are done by
>>the client
>>itself. the printing of the maps is done by getting the
>>pictures with curl or
>>http. there are 2 classes classes/weldMaps2PNG.php and and
>>classes/class_stripRequest.php.
>>in class_stripRequest.php there is a function setPNG()
>>change it for testing.
>>one problem: if you use curl for doing the request you must adopt
>>class_connector.php, cause curl have problems with 'image/png; mode=
>>24bit' in urls - i've got a adopted one if you need it. ;-)
>>greetings
>>armin
>>Am Mittwoch 29 April 2009 14:56:37 schrieb Schönhammer, Herbert:
>>> 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_pri
>>>nttest-agg24.map&VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&LAYE
>>RS=strassenach
>>>sen&STYLES=&SRS=EPSG:31468&BBOX=4506700.1038532015,5431380.999
>>99632,4506868.
>>>999796765,5431617.833858754&WIDTH=1780&HEIGHT=2496&FORMAT=imag
>>e/png;%20mode=
>>>24bit&BGCOLOR=0xffffff&TRANSPARENT=TRUE&EXCEPTIONS=application
>>/vnd.ogc.se_in
>>>image
>>>
>>> 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&VE
>>RSION=1.1.1&
>>>REQUEST=GetMap&SERVICE=WMS&LAYERS=strassenachsen&STYLES=&SRS=E
>>PSG:31468&BBOX
>>>=4506700.1038532015,5431380.99999632,4506868.999796765,5431617
>>.833858754&WID
>>>TH=1780&HEIGHT=2496&FORMAT=image/png&BGCOLOR=0xffffff&TRANSPAR
>>ENT=TRUE&EXCEP
>>>TIONS=application/vnd.ogc.se_inimage HTTP/1.0" 200 37121 "-" "-"
>>>
>>> for trying:
>>>
>>http://stadtplan2.regensburg.de/cgi-bin/getows?map=/cityportal-
>>maps/rgb_pri
>>>nttest-agg24.map&VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&LAYE
>>RS=strassenach
>>>sen&STYLES=&SRS=EPSG:31468&BBOX=4506700.1038532015,5431380.999
>>99632,4506868.
>>>999796765,5431617.833858754&WIDTH=1780&HEIGHT=2496&FORMAT=imag
>>e/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=stad
>>tplan&passwo
>>>rd=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
>>
>>
>>
>>--
>>Im Auftrag
>>--
>>Armin Retterath
>>
>>Kompetenz- und Geschäftsstelle Geodateninfrastruktur Rheinland-Pfalz
>>beim
>>Landesamt für Vermessung und Geobasisinformation Rheinland-Pfalz
>>
>>Ferdinand-Sauerbruch-Straße 15
>>56073 Koblenz
>>Telefon 0261/492-466
>>Telefax 0261/492-492
>>armin.retterath at lvermgeo.rlp.de
>>http://www.geoportal.rlp.de
>>_______________________________________________
>>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