[Geoserver-users] Print GIF from Geoserver 2.2.x Print Module

Hello,

I have been a Geoserver user for a couple of years (2.0.2 and now 2.2.5) and have recently installed the Print Module (Geoserver-2-2-SNAPSHOT-printing-plugin.zip) from the geoserver/2.2x/community-2013-08-19 folder on the build server. I have installed this, can run the demo page and print a pdf from it without any problem.

As part of my current project’s requirements I need to be able to print GIFs as well as PDFs and from doing a bit of research came to the conclusion that I needed to add a list of formats to my config.yaml file in the Data_dir/printing folder, added as:
formats: [‘pdf’,‘png’,‘gif’].

This I did but at no point does a list of outputFormats get returned in the json output from server/geoserver/pdf/info.json (below). I have made no other modifications to the config.yaml although I did experiment with adding extra scales/dpis which were returned successfully.

{“scales”:[{“name”:“1:25,000”,“value”:“25000”},{“name”:“1:50,000”,“value”:“50000”},{“name”:“1:100,000”,“value”:“100000”},{“name”:“1:200,000”,“value”:“200000”},{“name”:“1:500,000”,“value”:“500000”},{“name”:“1:1,000,000”,“value”:“1000000”},{“name”:“1:2,000,000”,“value”:“2000000”},{“name”:“1:4,000,000”,“value”:“4000000”}],“dpis”:[{“name”:“75”,“value”:“75”},{“name”:“150”,“value”:“150”},{“name”:“300”,“value”:“300”},{“name”:“600”,“value”:“600”}],“layouts”:[{“name”:“A4 portrait”,“map”:{“width”:440,“height”:483},“rotation”:true},{“name”:“Legal”,“map”:{“width”:440,“height”:483},“rotation”:false}],“printURL”:“server/geoserver/pdf/print.pdf”,“createURL”:“server/geoserver/pdf/create.json”}

After further investigation I came across a similar problem GEOS-5095 (https://jira.codehaus.org/browse/GEOS-5095) and a patch, which I believe I have successfully implemented into the printing module in the community/printing folder in the Git 2.2.x branch. After rebuilding this using mavern (3.0.03 on Mac OS X, unit tests were skipped during the build as these were failing thus I could not produce a jar file) I copied the output printing-2.2-SNAPSHOT.jar to my WEB-INF/lib directory but this generates a runtime error in OpenLayers.js (IndexSizeError: Index or size is negative or greater than the allowed amount, line 225) when I go to the Printing demo page server/geoserver/web/?wicket:bookmarkablePage=:org.geoserver.printing.PrintDemoPage.

Running the server/geoserver/pdf/info.json still does not provide any outputFormats either which I guess is the problem with OpenLayers because the formats JSONStore would be empty in the demo page. Thus I assume my problem to be around getting these formats into and out of the Printing plugin.

Geoserver is installed using the default Windows setup.exe and is running on Windows 7. The plugin work was done on Mac OS X Mountain Lion because this already had most of the requisites (mavern, eclipse, git, patch etc) available and the output jar file was just copied across. Geoserver information is as follows

2.2.5
8ab0318e82ed874a2198f7771ea85d52687ae3a2
25-Feb-2013 11:43
8-SNAPSHOT (rev 2aa9dae0f9a3e7d926918b3873b5d1ec59ab5efe)
JVM version: Oracle Corporation: 1.7.0_25 (Java HotSpot™ Client VM)

Any help, thoughts or pointers would be greatly received. Please let me know if any other information is required.

Many thanks,

Ben Hayward-Browne

Hi Ben,
I’m not using the GeoServer Print module myself but a separate stand-alone install of MapFishPrint (which is where the print module comes from).
My own one does include output formats in the info.json output:

{“scales”:[{“name”:“1:250”,“value”:“250”},…,{“name”:“1:10,000,000”,“value”:“10000000”}],“dpis”:[{“name”:“300”,“value”:“300”}],“outputFormats”:[{“name”:“bmp”},{“name”:“jpg”},{“name”:“wbmp”},{“name”:“jpeg”},{“name”:“png”},{“name”:“pdf”},{“name”:“gif”}],“layouts”:[{“name”:“A3 Landscape”,“map”:{“width”:1005,“height”:780},“rotation”:true},{“name”:“A3 Portrait”,“map”:{“width”:780,“height”:1020},“rotation”:true},{“name”:“A4 Landscape”,“map”:{“width”:675,“height”:542},“rotation”:true},{“name”:“A4 Portrait”,“map”:{“width”:535,“height”:700},“rotation”:true}],“printURL”:“http://wppgeog3:8090/print2.0/pdf/print.pdf”,“createURL”:“http://wppgeog3:8090/print2.0/pdf/create.json”}

formats: [‘*’]

This transmission is intended for the named addressee(s) only and may contain sensitive or protectively marked material up to RESTRICTED and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.

···

Also you can define the YAML to include all output formats with this:

You might want to try the stand alone MFP - it’s significantly newer than the one GeoServer uses. You can get a compiled snapshot from:
https://oss.sonatype.org/content/repositories/snapshots/org/mapfish/print/

Or maybe someone else can help you resolve the issue relayed in your post.

Regards,

Jonathan

On 8 October 2013 12:49, Ben Hayward-Browne <ben.hayward87@anonymised.com…> wrote:

Hello,

I have been a Geoserver user for a couple of years (2.0.2 and now 2.2.5) and have recently installed the Print Module (Geoserver-2-2-SNAPSHOT-printing-plugin.zip) from the geoserver/2.2x/community-2013-08-19 folder on the build server. I have installed this, can run the demo page and print a pdf from it without any problem.

As part of my current project’s requirements I need to be able to print GIFs as well as PDFs and from doing a bit of research came to the conclusion that I needed to add a list of formats to my config.yaml file in the Data_dir/printing folder, added as:
formats: [‘pdf’,‘png’,‘gif’].

This I did but at no point does a list of outputFormats get returned in the json output from server/geoserver/pdf/info.json (below). I have made no other modifications to the config.yaml although I did experiment with adding extra scales/dpis which were returned successfully.

{“scales”:[{“name”:“1:25,000”,“value”:“25000”},{“name”:“1:50,000”,“value”:“50000”},{“name”:“1:100,000”,“value”:“100000”},{“name”:“1:200,000”,“value”:“200000”},{“name”:“1:500,000”,“value”:“500000”},{“name”:“1:1,000,000”,“value”:“1000000”},{“name”:“1:2,000,000”,“value”:“2000000”},{“name”:“1:4,000,000”,“value”:“4000000”}],“dpis”:[{“name”:“75”,“value”:“75”},{“name”:“150”,“value”:“150”},{“name”:“300”,“value”:“300”},{“name”:“600”,“value”:“600”}],“layouts”:[{“name”:“A4 portrait”,“map”:{“width”:440,“height”:483},“rotation”:true},{“name”:“Legal”,“map”:{“width”:440,“height”:483},“rotation”:false}],“printURL”:“server/geoserver/pdf/print.pdf”,“createURL”:“server/geoserver/pdf/create.json”}

After further investigation I came across a similar problem GEOS-5095 (https://jira.codehaus.org/browse/GEOS-5095) and a patch, which I believe I have successfully implemented into the printing module in the community/printing folder in the Git 2.2.x branch. After rebuilding this using mavern (3.0.03 on Mac OS X, unit tests were skipped during the build as these were failing thus I could not produce a jar file) I copied the output printing-2.2-SNAPSHOT.jar to my WEB-INF/lib directory but this generates a runtime error in OpenLayers.js (IndexSizeError: Index or size is negative or greater than the allowed amount, line 225) when I go to the Printing demo page server/geoserver/web/?wicket:bookmarkablePage=:org.geoserver.printing.PrintDemoPage.

Running the server/geoserver/pdf/info.json still does not provide any outputFormats either which I guess is the problem with OpenLayers because the formats JSONStore would be empty in the demo page. Thus I assume my problem to be around getting these formats into and out of the Printing plugin.

Geoserver is installed using the default Windows setup.exe and is running on Windows 7. The plugin work was done on Mac OS X Mountain Lion because this already had most of the requisites (mavern, eclipse, git, patch etc) available and the output jar file was just copied across. Geoserver information is as follows

2.2.5
8ab0318e82ed874a2198f7771ea85d52687ae3a2
25-Feb-2013 11:43
8-SNAPSHOT (rev 2aa9dae0f9a3e7d926918b3873b5d1ec59ab5efe)
JVM version: Oracle Corporation: 1.7.0_25 (Java HotSpot™ Client VM)

Any help, thoughts or pointers would be greatly received. Please let me know if any other information is required.

Many thanks,

Ben Hayward-Browne


October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users