How do I use the MapFish print engine for the GeoServer-GeoWebCache layer?

I am developing a webGIS application using GeoServer (2.1.1), GeoWebCache (1.2.6), OpenLayers (2.11), GeoExt. All my layers serve wms via GeoWebCache. The sample definition for any level is as follows:

 var My_Layer = new OpenLayers.Layer.WMS( "My_Layer",
            "http://my-ip + my-port/geoserver/gwc/service/wms",
            {layers: 'layer-name',transparent: "true",format: "image/png",
             tileSize: new OpenLayers.Size(256,256),
             tilesOrigin : map.maxExtent.left + ',' + map.maxExtent.bottom },
            { isBaseLayer: false, visibility:false} );

      

Everything worked fine up to this point. But, when I was planning to go ahead a bit and tried to implement MapFish Printing module, the output pdf is empty !!! I am getting the following error:

java.io.IOException: Error (status = 400) while reading image from ........

I've searched a lot. According to this one option is to access my layers as a TMS layer. But I don't want a static image layer, not a GeoServer WMS map layer.

Again, another option here is using OpenLayers.Control.ExportMap (). But this limits the use of different scales as my data is too big. As a result, at a specific scale, if the user wants to make a printout of an entire area of ​​the map (maybe on A0 paper) that is not fully displayed in the Openlayers div, this cannot solve the purpose.

So the question is, how can I do this without using the TMS tier or GeoWebCache?

Edit # 1: Sorry I'm running late as I was out of the office. Below is the config.yaml file. I feel like there are no errors, this can print my WMS layers coming directly from the GeoServer.

dpis: [75, 150, 300]

outputFormats:
  - pdf

scales:
  - 10000
  - 25000
  - 50000
  - 100000

hosts:
  - !localMatch
    dummy: true
  - !ipMatch
    ip: www.camptocamp.org
  - !dnsMatch
    host: labs.metacarta.com
    port: 80
  - !dnsMatch
    host: terraservice.net
    port: 80
  - !dnsMatch
    host: sigma.openplans.org
  - !dnsMatch
    host: demo.mapfish.org

layouts:
  A4 portrait:
    metaData:
      title: 'Arunava TopoMap PDF'
      author: 'Arunava print module'
      subject: 'Map layout'
      keywords: 'map,print'
      creator: 'Arunava'
    mainPage:
      pageSize: A4
      rotation: true
      items:
        - !text
          text: '${mapTitle}  ${now MM.dd.yyyy}'
          fontSize: 20
          spacingAfter: 30
        - !map
          spacingAfter: 30
          width: 440
          height: 600
        - !scalebar
          type: bar
          maxSize: 100
          barBgColor: white
          fontSize: 8
          align: right
        - !text
          font: Helvetica
          fontSize: 9
          align: right
          text: '1:${scale}'
      footer: *commonFooter

  A2 portrait:
    metaData:
      title: 'Arunava TopoMap PDF'
      author: 'Arunava print module'
      subject: 'Map layout'
      keywords: 'map,print'
      creator: 'Arunava'
    mainPage:
      pageSize: A2
      rotation: true
      items:
        - !text
          text: '${mapTitle}  ${now MM.dd.yyyy}'
          fontSize: 20
          spacingAfter: 30
        - !map
          spacingAfter: 30
          width: 880
          height: 1200
        - !scalebar
          type: bar
          maxSize: 100
          barBgColor: white
          fontSize: 8
          align: right
        - !text
          font: Helvetica
          fontSize: 9
          align: right
          text: '1:${scale}'
      footer: *commonFooter

      

+3


source to share


1 answer


Without further debugging, error 400 is too vague for much help. From experience I can say that I saw an issue before where the geowebcache server doesn't like serving the wms layer you are requesting. Mapfish tries to do weird things with different tile sizes (and you end up with a 10% threshold error). Is your magazine showing the image it requested? Can you go to this tile in our browser to see what the server is actually saying? This is how I ended up exposing my problems.

For easier debugging, I've also created a separate card log to make it easier to find card issues. Use the Geoserver admin screen to figure out which logging profile you are using, then in that log4j.properties file add a separate append file for mapfish and direct all org.mapfish activity to it. This makes debugging much easier.



AND FINALLY my own personal crusade: in your config.yaml, do not use outputFormats: [pdf], use formats : ['pdf'] instead .

Although all documents describe outputFormat (and what is required in the client specification), the actual server configuration uses the 'formats' variable. I've posted a patch to make this clearer in the docs, but until then, let this note be a guide. If you want to get into the image output, that's the key.

+2


source







All Articles