Hi Robert, So just a quick one;
the error gwc request that you sent initially: http://maps.zgb.de/geoserver/gwc/service/wms?BBOX=1176787.0%2C6892762.5%2C1181754.1%2C6899536.0&HEIGHT=625&WIDTH=458&map_resolution=75&SERVICE=WMS&REQUEST=GetMap&STYLES=&TILESIZE=%7B%22w%22%3A256%2C%22h%22%3A256%7D&TRANSPARENT=true&VERSION=1.1.1&FORMAT=image%2Fpng&PROJECTION=EPSG%3A900913&format_options=dpi%3A75&LAYERS=zgb%3Atk50&SINGLETILE=false&SRS=EPSG%3A900913 doesn't work obviously, as you established. What I was saying about stripping out the gwc part is that if you replace http://maps.zgb.de/geoserver/gwc/service/wms? with http://maps.zgb.de/geoserver/zgb/wms? you will get a request that works: http://maps.zgb.de/geoserver/zgb/wms?BBOX=1176787.0%2C6892762.5%2C1181754.1%2C6899536.0&HEIGHT=625&WIDTH=458&map_resolution=75&SERVICE=WMS&REQUEST=GetMap&STYLES=&TILESIZE=%7B%22w%22%3A256%2C%22h%22%3A256%7D&TRANSPARENT=true&VERSION=1.1.1&FORMAT=image%2Fpng&PROJECTION=EPSG%3A900913&format_options=dpi%3A75&LAYERS=zgb%3Atk50&SINGLETILE=false&SRS=EPSG%3A900913 That is, in essence, what you have to do programatically whenever you want to print. Does that make more sense? Toby On 24 November 2011 14:34, Toby Reinicke <[email protected]> wrote: > Yes, printing is great fun! > So the 'related geoserver' layer stuff means that you catch the print > request before it is sent, and replace anything relating to gwc in it. I.e > if you are getting tiles from gwc using a bbox, chances are you can just > strip out the gwc part of the URL and send that request straight to the wms > layer on geoserver and get back the same image (albeit much slower). > That will get you any data that resides in geoserver (vectors and rasters > both). However if you are trying to print user generated polygons / text > that hasn't been committed to geoserver yet you're in a whole new ball > game. > Will have a play with your code over the next few days and see what I can > come up with. > Toby > On 24 Nov 2011, at 13:42, Robert Buckley <[email protected]> wrote: > > ok thanks. > If the solution is to server the layers as tms then i´m out of luck because > TMS is not working in my installed version of geoserver I don´t understand > what "redirecting the willed GWC > layers to the related GeoServer layers before they are printed" means.!!?! > I have tried to make a simple html print window in javscript, but now the > problem is that the raster backgrounds only work in IE9 on Windows7 and on > SP only the vector data can be printed! > I neve knew that printing could be such a head ache! > yours, > Rob > ________________________________ > Von: Tobias Reinicke <[email protected]> > An: Robert Buckley <[email protected]> > Gesendet: 14:02 Donnerstag, 24.November 2011 > Betreff: Re: [OpenLayers-Users] pdf export: why the request for tile > dimensions of 625x458 > > Hi Robert, > So from that link the sentence that is most important is: > > The solution is to use OpenLayers.Layer.TMS for the geowebcache layers > rather than OpenLayer.Layer.WMS > > So you're WMS layers needs to change to be a TMS layer, if that is > acceptable to you. The other solution is in the next post: > I also went into this problem few days ago. I tried using TMS layers but > without success. The solution I pitched on was redirecting the willed GWC > layers to the related GeoServer layers before they are printed. It's not a > pretty solution, but it works well! [1] > > > > [1] http://www.mail-archive.com/[email protected]/msg01973.html > > > > Toby > > On 24 November 2011 07:39, Robert Buckley <[email protected]> wrote: >> Hi, >> Thanks for the reply. >> according to my research it is possible. gbrun manaed to get this working >> with TMS services with the help of Matt Prior documented in the link >> below. >> The proof is in the online map here >> http://gis.catawbacountync.gov/gwc/print_gwc.html >> http://www.mail-archive.com/[email protected]/msg01973.html >> >> yours, >> Rob >> >> >> ________________________________ >> Von: Toby R <[email protected]> >> An: Robert Buckley <[email protected]> >> Cc: "[email protected]" >> <[email protected]>; "[email protected]" >> <[email protected]>; "[email protected]" <[email protected]>; >> "[email protected]" <[email protected]> >> Gesendet: 8:25 Donnerstag, 24.November 2011 >> Betreff: Re: [OpenLayers-Users] pdf export: why the request for tile >> dimensions of 625x458 >> >> Hi Robert, >> This may not be entirely helpful however I don't think that mapfish >> supports >> printing from a tile cache. The way it works normally is that it sends the >> request straight to the wms server which can obviously respond to the size >> it requires. >> The reason you are getting that tile size is because that's the size of >> the >> window you are trying to print (I presume). >> As a test, if you were to point your layer_topo straight to the wms does >> printing work? >> >> Toby >> >> >> On 24 Nov 2011, at 06:53, Robert Buckley <[email protected]> wrote: >> >> >> Hi, >> Problem: I can´t print any tiles coming from geowebcache! >> gridset: 900913 >> System: Linux Ubuntu 10.04 / tomcat6 / Geoserver 2.1.2 >> Javscript >> // map >> var map = new OpenLayers.Map("map", { >> id: 'map', >> projection: new OpenLayers.Projection("EPSG:900913"), >> displayProjection: new OpenLayers.Projection("EPSG:4326"), >> units: "m", >> maxResolution: 156543.0339, >> maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, >> 20037508.34), >> numZoomLevels: 17, >> controls: [new OpenLayers.Control.MouseDefaults(), new >> OpenLayers.Control.PanZoomBar(), new OpenLayers.Control.MousePosition(), >> new >> OpenLayers.Control.ScaleLine({ >> geodesic: true >> })] >> }); >> // layer GWC >> var layer_topo = new OpenLayers.Layer.WMS("Topographischekarte", >> "http://maps.zgb.de/geoserver/gwc/service/wms/", { >> layers: 'zgb:tk50', >> projection: "EPSG:900913", >> format: 'image/png', >> transparent: true, >> singleTile: false >> }, { >> 'buffer': 0, >> 'opacity': 1, >> 'isBaseLayer': true, >> visibility: true >> }); >> Geoserver log >> 2011-11-24 07:39:54,199 ERROR [geowebcache.GeoWebCacheDispatcher] - The >> requested tile dimensions 625x458 do not match those of the grid set >> (256x256) http://maps.zgb.de/geoserver/gwc/service/wms >> 2011-11-24 07:39:54,200 WARN [print.PDFUtils] - Server returned an error >> for >> >> http://maps.zgb.de/geoserver/gwc/service/wms?BBOX=1176787.0%2C6892762.5%2C1181754.1%2C6899536.0&HEIGHT=625&WIDTH=458&map_resolution=75&SERVICE=WMS&REQUEST=GetMap&STYLES=&TILESIZE=%7B%22w%22%3A256%2C%22h%22%3A256%7D&TRANSPARENT=true&VERSION=1.1.1&FORMAT=image%2Fpng&PROJECTION=EPSG%3A900913&format_options=dpi%3A75&LAYERS=zgb%3Atk50&SINGLETILE=false&SRS=EPSG%3A900913: >> Error (status=400) while reading the image from >> >> http://maps.zgb.de/geoserver/gwc/service/wms?BBOX=1176787.0%2C6892762.5%2C1181754.1%2C6899536.0&HEIGHT=625&WIDTH=458&map_resolution=75&SERVICE=WMS&REQUEST=GetMap&STYLES=&TILESIZE=%7B%22w%22%3A256%2C%22h%22%3A256%7D&TRANSPARENT=true&VERSION=1.1.1&FORMAT=image%2Fpng&PROJECTION=EPSG%3A900913&format_options=dpi%3A75&LAYERS=zgb%3Atk50&SINGLETILE=false&SRS=EPSG%3A900913: >> Bad Request >> pdf error attatchment >> java.io.IOException: Error (status=400) while reading the image from >> >> http://maps.zgb.de/geoserver/gwc/service/wms?BBOX=1091694.4%2C6741760.5%2C1250642.0%2C6958507.0 >> &HEIGHT=625&WIDTH=458 >> &map_resolution=75&SERVICE=WMS&REQUEST=GetMap >> &STYLES=&TILESIZE=%7B%22w%22%3A256%2C%22h%22%3A256%7D&TRANSPARENT=true >> >> &VERSION=1.1.1&FORMAT=image%2Fpng&PROJECTION=EPSG%3A900913&format_options=dp >> i%3A75&LAYERS=zgb%3Atk50&SINGLETILE=false&SRS=EPSG%3A900913: Bad Request >> >> >> >> Can anyone tell me why the mapfish print is requesting tile dimensions of >> 625x458? >> >> >> Yours with thanks, >> Rob >> >> _______________________________________________ >> Users mailing list >> [email protected] >> http://lists.osgeo.org/mailman/listinfo/openlayers-users >> >> >> >> _______________________________________________ >> Users mailing list >> [email protected] >> http://lists.osgeo.org/mailman/listinfo/openlayers-users >> >> > > > _______________________________________________ > Users mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/openlayers-users > _______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
