Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

System: Ubuntu 10.04 server / Tomcat6 / geoserver2.1.2 with integrated GeoWebCache

I have various webmapping applications running which utilize the mapfish print module.Some are in tomcat6/webapps some are in my apache2 DocRoot. I need to have various mapfish print layouts to show different logos, legends, scalebars etc depending on which webmapping application is using it....but I only have one config.yaml file to style the pdf layout.

Qustion: How can Have I various versions of config.yaml and link them to the different webapps?

I´d be grateful for any replies,

yours,

Rob

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

Normally it shouldn't be necessary to have multiple configuration files for the mapfish print module because you can make multiple layouts in your config file (with optional parameters) which you then post to the pdf/create.json URL. This page has some info (although it's a little outdated): http://www.mapfish.org/doc/print/configuration.html. In essence you can just add multiple layout descriptions like this:

layouts:
   {LAYOUT_NAME}:
?   : Mapfish-print.pdf  MF_V1.2
?   metaData:
?     {METADATA_DEFINITION}
?   titlePage:
?     {PAGE_DEFINITION}
    mainPage:
?     rotation: false
      {PAGE_DEFINITION}
?   lastPage:
?     {PAGE_DEFINITION}
  {...}

(note: use ! in front of a parameter to make it optional)

The only way to have multiple configurations (that I know of) is to have multiple print links which all use a separate config. You can do that by editing the /usr/lib/apache-tomcat/webapps/print/WEB-INF/web.xml file and add more servlets:

    <servlet>
    <servlet-name>mapfish.print2</servlet-name>
    <servlet-class>org.mapfish.print.servlet.MapPrinterServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>your_2nd_config_here.yaml</param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>mapfish.print2</servlet-name>
    <url-pattern>/pdf_nameoftheurl/*</url-pattern>
  </servlet-mapping>

  <servlet>
    <servlet-name>mapfish.print3</servlet-name>
    <servlet-class>org.mapfish.print.servlet.MapPrinterServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>your_3rd_config_here.yaml</param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>mapfish.print3</servlet-name>
    <url-pattern>/pdf_anotherurlname/*</url-pattern>
  </servlet-mapping>

I hope this gives you enough information to get it working!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.