[Users] geoext Printprovider bad request
Bernhard Kiselka
bernhard.kiselka at prisma-solutions.at
Fri Aug 26 16:57:38 CEST 2011
Hi Ralph!
I'm also suspicious about the width and height.
If I compare the scales of your test-app and the scales of your printcapabilities, they do not match.
Try to set the same scales in your print config.yaml as the application has:
mapPanel.map.layers[0].scales = [433344.01634946937, 216672.00817473468, 108336.00408736734, 54168.00204368367, 27084.001021841836, 13542.000510920918, 6771.000255460459, 3385.5001277302295, 1692.7500638651147, 846.3750319325574, 423.1875159662787, 211.59375798313934];
Hope that helps!
Cheers,
Bernhard
-----Ursprüngliche Nachricht-----
Date: Fri, 26 Aug 2011 10:15:26 -0400
From: "Ralph Dell" <RDell at CatawbaCountyNC.gov>
Subject: Re: [Users] geoext Printprovider bad request
To: <users at geoext.org>
Message-ID:
<C8E14DAE4E28C647A5DAB20B4F7CB60904872D40 at COCATEX01.cocat.local>
Content-Type: text/plain; charset="utf-8"
Unfortunately I am still unable to print my layers from geowebcache. Here is some code snippets and a link to a demo page.
Any more pointers will be appreciated. The pdf will not contain my gwc layers, otherwise all is well.
My gwc layer
baseLayer = new OpenLayers.Layer.WMS(
'gwc', 'http://gis.catawbacountync.gov/geoserver/gwc/service/wms', {
layers: ['catawba:nc_cities2'],
transparent:'true',
format: 'image/png',
tiled:true
},{
isBaseLayer: true,
buffer: 1,
tileSize: new OpenLayers.Size(256,256),
//tileOrigin: (-20037508, -20037508),
visibility: true,
displayInLayerSwitcher: false
});
My print provider and print page
printProvider = new GeoExt.data.PrintProvider({
method: "POST",
url: 'http://gis.catawbacountync.gov/geoserver/pdf',
autoLoad: true,
listeners: {
"loadcapabilities": function () {
printProvider.setLayout(printProvider.layouts.getAt(0));
},
"printexception": function(printProvider,response) {
alert("An error has occurred: " + response.statusText);
}}
});
printPage = new GeoExt.data.PrintPage({
printProvider: printProvider,
customParams: {
mapTitle: "gwc print",
comment: ""
}});
My print tool
action = new Ext.Action({
text: "Print",
scale: 'medium',
tooltip: "Print map - PDF",
handler: function() {
printPage.setCenter(map.getCenter());
printPage.fit(map, {mode: "closest"});
printProvider.print(mapPanel, printPage);
},?
Link to a demo
http://www.gis.catawba.nc.us/gwc/print_gwc.html
Ralph Dell
From: Matt Priour [mailto:mpriour at kestrelcomputer.com]
Sent: Wednesday, August 24, 2011 4:19 PM
To: Ralph Dell; users at geoext.org
Subject: Re: [Users] geoext Printprovider bad request
You can use gwc?s wms, just not as a single tile layer:
tileSize: new OpenLayers.Size(256,256)
is a _required_ config property of the layer(s) you are trying to print.
Your other option is to use an XYZ layer type with your gwc layers.
Matt Priour
Kestrel Computer Consulting
From: Ralph Dell <mailto:RDell at CatawbaCountyNC.gov>
Sent: Wednesday, August 24, 2011 2:22 PM
To: users at geoext.org
Subject: [Users] geoext Printprovider bad request
I did not know if this list or the geoserver list would be a better forum for this question. I decided to start here.
After adding layers to my map from geowebcache and generating a pdf with the Printprovider the gwc layers were not showing up in the generated pdf.
My straight up wms layes etc, were printing fine as usual.
In my geoserver logs I found the following information that indicated a bad request.
2011-08-24 13:27:21,287 WARN [org.mapfish.print.PDFUtils] -
Server returned an error for http://gis.catawbacountync.gov/geoserver/gwc/service/wms?
BBOX=-9079690.0%2C4218281.5%2C-9006310.0%2C4294718.5&HEIGHT=694&WIDTH=667&TRANSPARENT=true&
map_resolution=100&VERSION=1.1.1&FORMAT=image%2Fpng&TILED=true&SERVICE=WMS&format_options=dpi%3A100&
LAYERS=ncgroup&REQUEST=GetMap&STYLES=&SRS=EPSG%3A900913:
Error (status=400) while reading the image from http://gis.catawbacountync.gov/geoserver/gwc/service/wms?
BBOX=-9079690.0%2C4218281.5%2C-9006310.0%2C4294718.5&HEIGHT=694&WIDTH=667&TRANSPARENT=true&
map_resolution=100&VERSION=1.1.1&FORMAT=image%2Fpng&TILED=true&SERVICE=WMS&format_options=dpi%3A100&
LAYERS=ncgroup&REQUEST=GetMap&STYLES=&SRS=EPSG%3A900913: Bad Request
2011-08-24 13:27:21,287 WARN [org.mapfish.print.PDFCustomBlocks] -
Error while adding a PDF elementjava.io.IOException:
Error (status=400) while reading the image from http://gis.catawbacountync.gov/geoserver/gwc/service/wms?
BBOX=-9079690.0%2C4218281.5%2C-9006310.0%2C4294718.5&HEIGHT=694&WIDTH=667&TRANSPARENT=true&
map_resolution=100&VERSION=1.1.1&FORMAT=image%2Fpng&TILED=true&SERVICE=WMS&format_options=dpi%3A100&
LAYERS=ncgroup&REQUEST=GetMap&STYLES=&SRS=EPSG%3A900913: Bad Request
I did not know why it was a bad request but I was suspicious of the HEIGHT and WIDTH
Pasting the url into my browser confirmed that by returning the error
400: The requested tile dimensions 694x667 do not match those of the grid set (256x256)
http://gis.catawbacountync.gov/geoserver/gwc/service/wms?BBOX=-9079690.0%2C4218281.5%2C-9006310.0%2C4294718.5&HEIGHT=694&WIDTH=667&TRANSPARENT=true&map_resolution=100&VERSION=1.1.1&FORMAT=image%2Fpng&TILED=true&SERVICE=WMS&format_options=dpi%3A100&LAYERS=ncgroup&REQUEST=GetMap&STYLES=&SRS=EPSG%3A900913
OK great. What can I do to resolve the issue? Can I use my gwc layers with the printProvider? Do I have deeper issues?
Ralph Dell
More information about the Users
mailing list