From: Scott P. <sco...@ho...> - 2005-10-13 12:33:33
|
<html><p>Hi,<br> </p> <p><br> I am using the GeoTiffReader. Here is a code snippet from my application:<br> </p> <p> //getting a reader<br> AbstractGridFormat format = new GeoTiffFormat();<br> <br> if (format.accepts(image)) {<br> GridCoverageReader reader = new GeoTiffReader(format, image, null);<br> GridCoverage gc = null;<br> try {<br> gc = reader.read(null);<br> } catch (IOException ioe) {<br> System.out.println(ioe.getMessage());<br> }<br> ...<br> </p> <p>With this code snippet, I occassionally get the following error:<br> </p> <p><b><br> </b></p> <p><b>exception</b> </p> <pre>org.apache.jasper.JasperException: String index out of range: -47<br> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)<br> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)<br> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)<br> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)<br> org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)<br></pre> <p><b>root cause</b> </p> <pre>java.lang.StringIndexOutOfBoundsException: String index out of range: -47<br> java.lang.String.substring(String.java:1768)<br> org.geotools.gce.geotiff.GeoTiffIIOMetadataAdapter.getTiffAscii(GeoTiffIIOMetadataAdapter.java:1097)<br> org.geotools.gce.geotiff.GeoTiffIIOMetadataAdapter.getGeoKey(GeoTiffIIOMetadataAdapter.java:771)<br> org.geotools.gce.geotiff.GeoTiffException.getMessage(GeoTiffException.java:196)<br> edu.psu.geovista.gccm.FileUpload.getEmbeddedCoords(FileUpload.java:352)<br> org.apache.jsp.geoTiffOverlay_jsp._jspService(org.apache.jsp.geoTiffOverlay_jsp:73)<br> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)<br> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)<br> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)<br> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)<br> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)<br> javax.servlet.http.Htt pServlet.service(HttpServlet.java:802)<br> org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)<br></pre> <br>What is unusual is that the error only seems to occur with some GeoTiff Images. Some of the images work and some I get this error. Does anyone know what might be going on here?<br> <br> Also, does anyone have any sample code for how I would use the GeoTiffReader if the GeoTiff image that I am using has an asscoiated world file?<br> <br> Thanks,<br> Scott<br></html> |