1 | | Implement the!MapFish print server; Stéphane has documented (mailing list ?) how to set up the JAVA server directly in Tomcat, that is without the need to have !MapFish Server. |
| 1 | Implement the!MapFish print server. Here's what needs to be done. |
| 2 | |
| 3 | * Server-side requirements |
| 4 | |
| 5 | * Install Maven (http://maven.apache.org/download.html) |
| 6 | * Put install path (on windows : C:\Program Files\apache-maven-2.2.0\bin) on the system path |
| 7 | * Test on a commandline : ' mvn -version' |
| 8 | * Create the war file based on directory .../geoprisma/trunk/lib/externals/mapfish-print/print-servlet |
| 9 | * At the prompt type : 'mvn clean install' |
| 10 | * Deploy the war file in a Tomcat container |
| 11 | |
| 12 | * Apache conf |
| 13 | |
| 14 | * In the !GeoPrisma Apache conf, create a reverse proxy to direct requests to the print server, e.g.; |
| 15 | {{{ |
| 16 | LoadModule proxy_module modules/mod_proxy.so |
| 17 | LoadModule proxy_connect_module modules/mod_proxy_connect.so |
| 18 | LoadModule proxy_http_module modules/mod_proxy_http.so |
| 19 | LoadModule proxy_ftp_module modules/mod_proxy_ftp.so |
| 20 | |
| 21 | ProxyRequests Off |
| 22 | <Proxy *> |
| 23 | Order deny,allow |
| 24 | Allow from all |
| 25 | </Proxy> |
| 26 | ProxyPass /print http://localhost:9998/print-servlet-1.2-SNAPSHOT/pdf |
| 27 | ProxyPassReverse /print http://localhost:9998/print-servlet-1.2-SNAPSHOT/pdf |
| 28 | }}} |
| 29 | |
| 30 | |
| 31 | * Add this variable to configure the print server url: |
| 32 | {{{ |
| 33 | var printConfigUrl = '/print/info.json'; |
| 34 | }}} |
| 35 | |
| 36 | * !GeoPrisma service implementation |
| 37 | |
| 38 | * Implement a new service |
| 39 | * Implement a new 'print proxy' to that service |
| 40 | * Make sure the print proxy can use proxy classes to resolve service url and to modify the url string contained in the JSON object sent to the print server, e.g. |
| 41 | {{{ |
| 42 | |
| 43 | http://localhost:9998/print-servlet-1.2-SNAPSHOT/ |
| 44 | |
| 45 | See baseURL. |
| 46 | { |
| 47 | layout: 'A4 portrait', |
| 48 | title: 'A simple example', |
| 49 | srs: 'EPSG:4326', |
| 50 | units: 'dd', |
| 51 | layers: [ |
| 52 | { |
| 53 | type: 'WMS', |
| 54 | format: 'image/png', |
| 55 | layers: ['basic'], |
| 56 | baseURL: 'http://labs.metacarta.com/wms/vmap0' |
| 57 | }, |
| 58 | { |
| 59 | type: 'WMS', |
| 60 | format: 'image/png', |
| 61 | layers: ['routes'], |
| 62 | baseURL: 'http://www.camptocamp.org/cgi-bin/mapserv_c2corg', |
| 63 | customParams: {TRANSPARENT:true} |
| 64 | } |
| 65 | ], |
| 66 | pages: [ |
| 67 | { |
| 68 | center: [6, 45.5], |
| 69 | scale: 4000000, |
| 70 | dpi: 190, |
| 71 | mapTitle: "First map", |
| 72 | comment: "The \"routes\" layer is not shown (the scale is too small)", |
| 73 | data: [ |
| 74 | {id:1, name: 'blah', icon: 'icon_pan'}, |
| 75 | {id:2, name: 'blip', icon: 'icon_zoomin'} |
| 76 | ] |
| 77 | }, |
| 78 | { |
| 79 | center: [6.9, 46.2], |
| 80 | scale: 500000, |
| 81 | dpi: 190, |
| 82 | mapTitle: "Second map", |
| 83 | comment: "This is a zoomed in version of the first map. Since the scale is more appropriate, we show the \"routes\" layer.", |
| 84 | data: [ |
| 85 | {id:1, name: 'blah', icon: 'icon_pan'}, |
| 86 | {id:2, name: 'blip', icon: 'icon_zoomin'} |
| 87 | ] |
| 88 | } |
| 89 | ] |
| 90 | } |
| 91 | }}} |
| 92 | |
| 93 | |
| 94 | !GeoPrisma will replace the url shown above by that of the print proxy and the various !GeoPrisma proxy parameters. The print proxy will re-map the url to the one specified in the Apache conf file |