[Geomoose-users] Printing wms layers
    Bistrais, Bob 
    Bob.Bistrais at maine.gov
       
    Fri Dec  9 12:03:25 EST 2011
    
    
  
I THINK I've managed a workaround, or at least something that seems to
give me better results.  This was done by editing the print_util.php
file.  There are two lines which invoke the ImageCopyMerge command.
With a bit of research on the PHP forums, I found that this command is
problematic for some.  The workaround is to use the ImageCopy command
instead.  
 
So instead of:
ImageCopyMerge($printImage, $image, 0, 0, 0, 0, $mapImageWidth,
$mapImageHeight, (float)$opacities[$i]);
 
Replace with:
ImageCopy($printImage, $image, 0, 0, 0, 0, $mapImageWidth,
$mapImageHeight);
 
With this patch, my alpha channels are no longer black, but transparent.
The PDF output is still a bit fuzzy.  We already know that PHP's PDF
output is less than ideal, but at least I'm getting a hardcopy output
that is usable.
 
Many thanks to everyone for their input, it helped point me in the
direction I needed to find this workaround.  I hope the above will help
others having the same problem.
 
Bob
 
________________________________
From: geomoose-users-bounces at lists.osgeo.org
[mailto:geomoose-users-bounces at lists.osgeo.org] On Behalf Of Dan Little
Sent: Tuesday, November 29, 2011 4:39 PM
To: Bistrais, Bob; TC Haddad; geomoose-users at lists.osgeo.org
Subject: Re: [Geomoose-users] Printing wms layers
 
This is a 2.2 install, right?
	 
	
________________________________
	From: "Bistrais, Bob" <Bob.Bistrais at maine.gov>
	To: Dan Little <danlittle at yahoo.com>; TC Haddad
<tchaddad at gmail.com>; geomoose-users at lists.osgeo.org 
	Sent: Tuesday, November 29, 2011 3:34 PM
	Subject: RE: [Geomoose-users] Printing wms layers
	Yeah, it's driving me up the wall.  I've made sure to set an
imagecolor and transparent on, on the WMS server.  But something's
getting lost on the print side, since the image looks normal on the app.
	 
	
________________________________
	From: geomoose-users-bounces at lists.osgeo.org
[mailto:geomoose-users-bounces at lists.osgeo.org] On Behalf Of Dan Little
	Sent: Tuesday, November 29, 2011 2:51 PM
	To: Bistrais, Bob; TC Haddad; geomoose-users at lists.osgeo.org
	Subject: Re: [Geomoose-users] Printing wms layers
	 
	The composite print image is a JPEG but the request coming in
should be a JPG.  If you've got no background fill it *might* be filling
black instead of white but I'd bet there is still an alpha problem.
		 
		
________________________________
		From: "Bistrais, Bob" <Bob.Bistrais at maine.gov>
		To: Dan Little <danlittle at yahoo.com>; TC Haddad
<tchaddad at gmail.com>; geomoose-users at lists.osgeo.org 
		Sent: Tuesday, November 29, 2011 1:50 PM
		Subject: RE: [Geomoose-users] Printing wms layers
		OK, I uppercased that, still getting the black alpha
channel.  But here's something interesting.  Looking at the response
URL:
		 
	
http://localhost/broadband/php/download.php?id=print_13225959874924&ext=
jpg
		 
		 
		-Notice that the URL ends with ext=jpg.  So it looks
like I'm getting a jpeg even though I think I'm asking for png.
		 
		
________________________________
		From: geomoose-users-bounces at lists.osgeo.org
[mailto:geomoose-users-bounces at lists.osgeo.org] On Behalf Of Dan Little
		Sent: Tuesday, November 29, 2011 2:40 PM
		To: Bistrais, Bob; TC Haddad;
geomoose-users at lists.osgeo.org
		Subject: Re: [Geomoose-users] Printing wms layers
		 
		You may need to have "format" all-capsed "FORMAT".  This
is a OpenLayers thing...
			 
			
________________________________
			From: "Bistrais, Bob" <Bob.Bistrais at maine.gov>
			To: Dan Little <danlittle at yahoo.com>; TC Haddad
<tchaddad at gmail.com>; geomoose-users at lists.osgeo.org 
			Sent: Tuesday, November 29, 2011 1:36 PM
			Subject: RE: [Geomoose-users] Printing wms
layers
			Hi Tanya, Dan, and everyone,
			 
			In mapbook.xml, I do have the format param set
to image/png, for those WMS layers which I want to have the Alpha
channels in.  That's in the parameters, but the URL itself is just the
path to the server, such as this:
			 
			      <map-source name="base-vector" type="wms"
tiled="false" projection='EPSG:26919'>
	
<url>http://mapservertest.maine.gov/wms/mapserv.exe</url>
			                        <layer name="Roads"
queryable="false"/>
			                        <layer name="Boundaries"
queryable="false"/>
			                        <param name="map"
value="c:/wms/basemapNew.map"/>
			                        <param name="format"
value="image/png"/>        
			                        <param
name="TRANSPARENT" value="TRUE"/>            
			                <param name="STYLES" value=""/>
			        </map-source>
			 
			 
			As far as I can tell, that's the correct format,
but if anyone sees anything out of place, or wants to try that WMS
service, please feel free to do so.  As I mentioned, I have full control
over that WMS service as well, so I can make adjustments there, too.
			 
			
________________________________
			From: geomoose-users-bounces at lists.osgeo.org
[mailto:geomoose-users-bounces at lists.osgeo.org] On Behalf Of Dan Little
			Sent: Tuesday, November 29, 2011 1:32 PM
			To: TC Haddad; geomoose-users at lists.osgeo.org
			Subject: Re: [Geomoose-users] Printing wms
layers
			 
			Odd, any "param"s tags should get applied.
			 
			having:
			 
			<param name="FORMAT">image/png</param> 
			 
			Should force the image to print as image/png,
keeping the alpha channel.
			 
				 
				
________________________________
				From: TC Haddad <tchaddad at gmail.com>
				To: "geomoose-users at lists.osgeo.org"
<geomoose-users at lists.osgeo.org> 
				Sent: Wednesday, November 23, 2011 4:45
PM
				Subject: Re: [Geomoose-users] Printing
wms layers
				Yeah the point is that if you don't
specify:
				
				format=image/png
				
				in the WMS URL, then the print script
will form a url for you that includes the default value:
				
				format-image/jpeg
				
				and this is bad for your print job
because JPEG doesn't support transparency.
				
				The server is just delivering what the
URL is asking it to...
				
				Tanya
				On Wed, Nov 23, 2011 at 2:41 PM, Bob
Basques <Bob.Basques at ci.stpaul.mn.us> wrote:
				JPEG may be a catch all since Aerial
photos look best as JPEG. 
				 
				As far as the FORMAT= piece, I know that
our WMS serves in 7 different response formats.  Two different PNG
formats. 
				 
				bobb 
				 
				
				
				>>> TC Haddad <tchaddad at gmail.com>
wrote:
Bob,
does the actual WMS url have the "Format=" specified? even though you
have set it to respond in PNG?
because if not, it looks like the print_util.php will force it to
default to JPEG (line 112-ish)
On Wed, Nov 23, 2011 at 2:25 PM, Jim Klassen <klassen.js at gmail.com>
wrote:
	MapServer uses AGG by default in 6.x and as an option in 5.x. 
	 
	The print.php script in GeoMoose uses GD (via PHP bindings) and
is independent of MapServer. (Recall not all layers in a GeoMoose site
have to come from MapServer.)
	 
	On Nov 23, 2011, at 16:20, TC Haddad <tchaddad at gmail.com> wrote:
	 
		dumb question:
		
		Is GD really being used? I thought it was replaced (in
Mapserver) in favor of AGG a while back...
		
		Tanya
		On Wed, Nov 23, 2011 at 1:58 PM, Jim Klassen
<klassen.js at gmail.com> wrote:
			Why is because it isn't the proper resolution or
aspect ratio for printing. 
			 
			Why it renders different is because in GeoMoose
the browser does the image compositing. In the print utility there is no
browser so the GD library needs to handle it. Why not print from the
browser? Because not all browsers print the same and mans don't handle
printing the composited images correctly. In any case high res prints
(think plotter) would be out of the question.
			 
			
			On Nov 23, 2011, at 14:27, "Bistrais, Bob"
<Bob.Bistrais at maine.gov> wrote:
			 
				I copied over the new function and
function call in print_util.php. I get what's going on there- it's
"cutting out" the black portions of the image, but I'm still getting
these in the printable image. 
				 
				One thing I don't understand (and the
answer is probably not so simple)- the map is looking exactly as I'd
like in the application- why aren't we grabbing that image and coping it
to the output map file? 
				 
				
________________________________
				From:
geomoose-users-bounces at lists.osgeo.org
[mailto:geomoose-users-bounces at lists.osgeo.org] On Behalf Of Brent
Fraser
				Sent: Wednesday, November 23, 2011 11:33
AM
				To: Bistrais, Bob
				Cc: geomoose-users at lists.osgeo.org
				Subject: Re: [Geomoose-users] Printing
wms layers 
				 
				Bob,
				
				I did a fix some time ago
(http://geomoose.org/trac/ticket/108) regarding using the alpha channel
in Print_util.php. This fix is in GeoMoose v2.4 so I'm confused...
				  
				Best Regards,
				  
				  
				Brent Fraser
				  
				
				On 11/23/2011 9:27 AM, Bistrais, Bob
wrote: 
				It sure looks like a problem with the
alpha channels. Doesn't seem to matter which browser I use, either. 
				 
				
________________________________
				From: Jim Klassen
[mailto:klassen.js at gmail.com]
				Sent: Wednesday, November 23, 2011 10:43
AM
				To: Bistrais, Bob
				Cc: Bob Basques;
<geomoose-users at lists.osgeo.org <mailto:geomoose-users at lists.osgeo.org>
>
				Subject: Re: [Geomoose-users] Printing
wms layers 
				 
				If the quality is different between PNG
and GIF you are probably using PNG24 (as PNG8 and GIF should be
identical image wise). 
				 
				My guess is a GD bug dealing with PNG24.
I'm not sure what your options are, but it sounds like the print.php
needs to be rewritten with a more modern library. 
				
				On Nov 23, 2011, at 9:11, "Bistrais,
Bob" <Bob.Bistrais at maine.gov> wrote: 
				Looks like I'm using png. 
				 
				One thing I tried was to use gif in the
mapbook.xml, for those WMS layers, but while they displayed alright, the
quality was awful. 
				 
				
________________________________
				From: Bob Basques
[mailto:Bob.Basques at ci.stpaul.mn.us]
				Sent: Wednesday, November 23, 2011 10:05
AM
				To: geomoose-users at lists.osgeo.org;
Bistrais, Bob
				Subject: RE: [Geomoose-users] Printing
wms layers 
				 
				What version of PNG, PNG8 PNG24, etc.  
				 
				bobb  
				 
				
				
				>>> "Bistrais, Bob"
<Bob.Bistrais at maine.gov> wrote: 
Yes, the WMS is outputting PNG. What would be recommended instead?  
 
________________________________
From: Bob Basques [mailto:Bob.Basques at ci.stpaul.mn.us]
Sent: Tuesday, November 22, 2011 4:54 PM
To: geomoose-users at lists.osgeo.org; Bistrais, Bob
Subject: Re: [Geomoose-users] Printing wms layers  
 
Something to look at . . .  
 
What is the format of the images from the WMS service?  
 
PNG24 vs other PNG formats have caused problem in cross browser
situations. Some versions of IE don't like one or the other for example.
 
bobb  
 
>>> "Bistrais, Bob" <Bob.Bistrais at maine.gov> wrote:  
I had brought up this question before but it seems to be happening
again. I have a few layers that I consume in GeoMoose by WMS. Some of
these are vecot line layers such as roads. They work perfectly in
GeoMoose map view. But when I compose a printable map, these layers have
a black background which obscures other layers and just plain looks
ugly. If I set the "transparent" property to false, the black background
goes away, but then I can't see any underlying data. 
 
By the way, I do have control over the WMS services in this case. I
tried to set Offsite to 0 0 0, but that didn't seem to help either. The
WMS is at MapServer 6.0.1. Any suggestions?  
				 
	
_______________________________________________
				Geomoose-users mailing list
				Geomoose-users at lists.osgeo.org
	
http://lists.osgeo.org/mailman/listinfo/geomoose-users 
				 
				 
				 
				  
	
_______________________________________________
				  
				  
				Geomoose-users mailing list
				  
				  
				Geomoose-users at lists.osgeo.org
<mailto:Geomoose-users at lists.osgeo.org> 
				  
				  
	
http://lists.osgeo.org/mailman/listinfo/geomoose-users
<http://lists.osgeo.org/mailman/listinfo/geomoose-users> 
				  
				  
				> 
				  
				Geomoose-users mailing list
				  
				  
				Geomoose-users at lists.osgeo.org
<mailto:Geomoose-users at lists.osgeo.org> 
				  
				  
	
http://lists.osgeo.org/mailman/listinfo/geomoose-users
<http://lists.osgeo.org/mailman/listinfo/geomoose-users> 
				  
				  
	
_______________________________________________
				Geomoose-users mailing list
				Geomoose-users at lists.osgeo.org
	
http://lists.osgeo.org/mailman/listinfo/geomoose-users
			
			_______________________________________________
			Geomoose-users mailing list
			Geomoose-users at lists.osgeo.org
	
http://lists.osgeo.org/mailman/listinfo/geomoose-users
		 
		_______________________________________________
		Geomoose-users mailing list
		Geomoose-users at lists.osgeo.org
		http://lists.osgeo.org/mailman/listinfo/geomoose-users
 
				 
				
	
_______________________________________________
				Geomoose-users mailing list
				Geomoose-users at lists.osgeo.org
	
http://lists.osgeo.org/mailman/listinfo/geomoose-users
			 
		 
	 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geomoose-users/attachments/20111209/12b20626/attachment-0001.html
    
    
More information about the Geomoose-users
mailing list