Hello all,

This is my first message to this list as I only recently started using 
GeoServer, and I hope I've come to the right place.

When playing with the Heron Mapping Client, GeoServer and Mapfish Print, 
I found I could not print any TMS layer. In the end, I found a 
solution/workaround.

I'm using GeoServer 2.2.2 on on OpenSuSU 11.4 with OpenJDK Runtime 
Environment (IcedTea6 1.11.5), Apache 2 and Tomcat6.
Print module from 
http://gridlock.opengeo.org/geoserver/2.2.x/community-latest/geoserver-2.2-SNAPSHOT-printing-plugin.zip.
Heron MC from http://geoext-viewer.googlecode.com/files/heron-0.70.zip. 
Using configuration based on DefaultOptionsNL_PDOK.js. Sample TMS layer 
(in EPSG:28992 map):

new OpenLayers.Layer.TMS("Achtergrondkaart",
                 Heron.pdok.urls.PDOKTMS,
                 {
                         layername: 'brtachtergrondkaart',
                         type: 'png',
                         format: "image/jpg",
                         isBaseLayer: true,
                         transparent: true,
                         bgcolor: "0xffffff",
                         visibility: true,
                         singleTile: false,
                         alpha:true,
                         opacity: 1.0,
                         attribution: "Bron: BRT Achtergrondkaart, © <a 
href='http://openstr...
              }
         )

When trying to print a map with this layer or any other TMS layer, this 
fails with the following exception in geoserver.log:

2012-12-08 18:28:02,292 ERROR [servlet.BaseMapServlet] - Error while 
generating PDF
DocumentException:_
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
 >   at java.lang.String.substring(String.java:1949)
 >   at 
org.mapfish.print.map.readers.TmsMapReader.<init>(TmsMapReader.java:48)
 >   at 
org.mapfish.print.map.readers.TmsMapReader.create(TmsMapReader.java:86)
 >   at org.mapfish.print.map.readers.MapReader.create(MapReader.java:58)
 >   at 
org.mapfish.print.map.MapChunkDrawer.renderImpl(MapChunkDrawer.java:98)
 >   at org.mapfish.print.ChunkDrawer.render(ChunkDrawer.java:55)
 >   at org.mapfish.print.ChunkDrawer.tableLayout(ChunkDrawer.java:49)
 >   at com.lowagie.text.pdf.PdfPTable.writeSelectedRows(Unknown Source)
[...]

Got the source from https://github.com/mapfish/mapfish-print.git. I'm 
aware this may be different from the source used for the jars in 
http://gridlock.opengeo.org/geoserver/2.2.x/community-latest/geoserver-2.2-SNAPSHOT-printing-plugin.zip.
 
The exception seems to stem from parsing the format parameter. This 
parameter in turn seems based on the type from the layer definition.

I found that adding a semicolon to the type setting for the layers made 
the exception disappear and led to a successful creation of PDF's.

I believe the request from Heron/GeoExt to GeoServer's pdf/create.json 
is correct with a format parameter without the semicolon. The bit of 
code for parsing the format parameter in Mapfish Print looks OK in the 
version of the source I looked at; it checks for a semicolon before 
assuming there is one. But I don't know if that is the same in the 
sources for the version of the GeoServer print module I use...

I hope someone is interested in the information above. Maybe it's as 
simple a recompiling the GeoServer Printing Module from the latest sources.

Regards, and thank you,

J-----.

Jeroen Muris

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to