[Geoserver-users] Using geoserver print for png, gif, jpg etc.

Hi, I find vague information about how to use the GeoServer mapfish print capability for image creation but nothing that actually explains it in detail. I am generally technically adept in GeoServer in general but I can’t figure this one out. I have added the needed formats: param to the YAML file. I’ve also hardcoded into my JSON the “outputFormat”:“png” so I expect it should work. I’ve read up on the need for JAI and ImageIO and have verified in the OpenGeoSuite logs that those two jars are being loaded. But still when I ask to print a map it always returns pdf. I know I’m missing something but I can’t figure it out.

The Goal is to have users create annotated content in the light weight openLayers viewer and then be able to export that as an image and then overlay it in ArcGIS and do actual analysis. I’ve already managed to figure out the image World File so I just need the image. The PDF looks great, how do I get the image?

YAML:

dpis: [75, 150, 300, 600]

formats: [‘pdf’, ‘png’]

scales:

  • 524288000
  • 262144000
  • 131072000
    .
    .
    .

hosts:

  • !localMatch
    dummy: true
  • !ipMatch
    ip: 0.0.0.0
    mask: 0.0.0.0

layouts:

BIG:
metaData: &commonMetaData
title: “${mapTitle}”
author: “GeoExplorer”
subject: “Map printed with the OpenGeo Suite”
keywords: “map,print”
creator: “OpenGeo Suite”
mainPage:
pageSize: 1024 768
rotation: true
items:

  • !text
    text: “${mapTitle}”
    fontSize: 30
    spacingAfter: 30
    align: center
  • !map
    spacingAfter: 10
    width: 800
    height: 600
  • !scalebar
    type: bar
    maxSize: 100
    barBgColor: white
    fontSize: 8
    align: right
    spacingAfter: 10
  • !text
    text: “${comment}”

– PrintConfig (NOTE: Formats is not listed)

printCongif={"scales":[{...},{"name":"1:524,288,000","value":"524288000"}],
"dpis":[{"name":"75","value":"75"},{...},{"name":"600","value":"600"}],
"layouts":[{"name":"BIG","map":{"width":800,"height":600},"rotation":true}]

-- JSON:

| spec | {"units":"m","srs":"EPSG:4326","layout":"BIG","dpi":300,"outputFormat":"png",<br>"outputFilename":"UWPImage.png","mapTitle":"","comment":"",<br>"layers":[{"baseURL":"http://maps.opengeo.org/geowebcache/service/wms",<br>	"opacity":1,"singleTile":false,"type":"WMS","layers":["bluemarble"],"format":"image/png","styles":[""],<br>	"customParams":{"TRANSPARENT":true}}],"pages":[{"center":[0,0],"scale":2000,"rotation":0}]} |
| - | - |

Thoughts???

Thanks,
Mark

Hi Mark,

The GeoServer printing plugin is using an old version of Mapfish Print, from 2010, that didn’t support image output formats.

You’d need to update the mapfish print dependency and build the plugin yourself.
See the patch on https://jira.codehaus.org/browse/GEOS-5095

Oscar.

Thanks Oscar. Sounds like a nice little project for Monday morning.

Sent from my iPhone

On Feb 24, 2013, at 12:15 PM, Oscar Fonts <oscar.fonts@anonymised.com> wrote:

Hi Mark,

The GeoServer printing plugin is using an old version of Mapfish Print, from 2010, that didn’t support image output formats.

You’d need to update the mapfish print dependency and build the plugin yourself.
See the patch on https://jira.codehaus.org/browse/GEOS-5095

Oscar.

Hi Oscar and Mark,

Will it be possible for you guys to provide the necessary steps needed to
update the mapfish dependency and build the plugin myself? Sorry but this
will be my first take on building a plugin myself.

Thanks!

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Using-geoserver-print-for-png-gif-jpg-etc-tp5036192p5060345.html
Sent from the GeoServer - User mailing list archive at Nabble.com.