From: <Sys...@we...> - 2008-04-23 11:48:10
|
Hello list, after a long trial 'n' error session I finally could load a geotiff from disk into my webapp. Now I fail to get the same done via GeoServer. I tried the following - without success: URL tiffURL = new URL("http://localhost:1979/geoserver/wcs? service=WCS&...&format=GEOTIFF"); InputStream tiffIS = tiffURL.openStream(); GeoTiffFormat gtf = new GeoTiffFormat(); GeoTiffReader gtr = (GeoTiffReader) gtf.getReader( tiffIS ); GridCoverage2D gc = null; try { gc = (GridCoverage2D) gtr.read(null); System.out.println("GeoTIFF successfully loaded."); } catch (Exception e) { System.out.println("ERROR: Could not load GeoTIFF."); } Is this a acceptable approach or am I completely wrong? Which reader should I use aund how should I pass a WCS reference to this reader? Thanks for any hint, Christian |
From: Jody G. <jga...@re...> - 2008-04-23 18:50:23
|
We don't have a client api for WCS yet; I imagine you can use a GET request as you otutline below but it has been sometime since I have personally tried them out using URLs rather than files as the object. Oh I think you can pass the URL into the reader that than the raw input stream... My guess is you are in for a fun day of debugging. Jody > Hello list, > > after a long trial 'n' error session I finally could load a geotiff > from disk into my webapp. Now I fail to get the same done via GeoServer. > > I tried the following - without success: > > URL tiffURL = new URL("http://localhost:1979/geoserver/wcs? > service=WCS&...&format=GEOTIFF"); > InputStream tiffIS = tiffURL.openStream(); > > GeoTiffFormat gtf = new GeoTiffFormat(); > GeoTiffReader gtr = (GeoTiffReader) gtf.getReader( tiffIS ); > GridCoverage2D gc = null; > > try { > gc = (GridCoverage2D) gtr.read(null); > System.out.println("GeoTIFF successfully loaded."); > } > catch (Exception e) { > System.out.println("ERROR: Could not load GeoTIFF."); > } > > Is this a acceptable approach or am I completely wrong? > Which reader should I use aund how should I pass a WCS reference to > this reader? > > > Thanks for any hint, > > Christian > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save $100. > Use priority code J8TL2D2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > _______________________________________________ > Geotools-gt2-users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > |
From: <Sys...@we...> - 2008-04-24 06:46:14
|
Thanks Jody! Your guess is almost right, except for the part "day". I'm sure it will take longer ;-)... Well, if I get you right, you suggest something like this: URL tiffURL = new URL("http://localhost:1979/geoserver/wcs? service=WCS&...&format=GEOTIFF"); GeoTiffFormat gtf = new GeoTiffFormat(); GeoTiffReader gtr = (GeoTiffReader) gtf.getReader( tiffURL ); GridCoverage2D gc = null; I already tried this out, but the reader (line 3) failed (without any console output). Christian Am 23.04.2008 um 20:50 schrieb Jody Garnett: > We don't have a client api for WCS yet; I imagine you can use a GET > request as you otutline below but it has been sometime since I have > personally tried them out using URLs rather than files as the object. > > Oh I think you can pass the URL into the reader that than the raw > input > stream... > My guess is you are in for a fun day of debugging. > > Jody |
From: <Sys...@we...> - 2008-04-25 09:00:24
|
I got used to find workarounds in my project, so here is the workaround for this problem ;-): Since it was not possible to read the geotiff directly from the WCS server, I now save the inputstream in a local directory and afterwards use the GeoTiffReader to read the local file. Christian |