From: Jan T. <jan...@jt...> - 2012-11-08 17:17:50
|
Hi, I have a GeoTiff URL and want to read it using GeoTiffReader. According to http://jira.codehaus.org/browse/GEOT-3318 the reader needs a file, neither InputStream nor any byte[] (ByteArrayInputStream) variant works. Is there any other way? Do you have an idea how I could fix that? I have to read many files and want to avoid slow hard disk IO where possible. Cheers, Jan |
From: Jody G. <jod...@gm...> - 2012-11-09 07:49:59
|
Looks like you need a reader that is thread safe - any recommendations? -- Jody Garnett On 08/11/2012, at 3:19 PM, Jan Torben <jan...@jt...> wrote: > Hi, > > I have a GeoTiff URL and want to read it using GeoTiffReader. According to > http://jira.codehaus.org/browse/GEOT-3318 the reader needs a file, neither > InputStream nor any byte[] (ByteArrayInputStream) variant works. > > Is there any other way? Do you have an idea how I could fix that? I have to > read many files and want to avoid slow hard disk IO where possible. > > Cheers, > > Jan > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_nov > _______________________________________________ > GeoTools-GT2-Users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users |
From: Andrea A. <and...@ge...> - 2012-11-09 08:21:54
|
On Fri, Nov 9, 2012 at 8:49 AM, Jody Garnett <jod...@gm...> wrote: > Looks like you need a reader that is thread safe - any recommendations? > > The only thing I can think of that would not break the thread safety contract would be that the reader does a full copy of the stream into an in memory byte[] and then works off it. Scary if you ask me, if someone by mistake points to a large content the OOM is just round the corner Cheers Andrea -- == Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- |
From: Jody G. <jod...@gm...> - 2012-11-09 08:34:02
|
Staging into a temp file would be smarter. -- Jody Garnett On 09/11/2012, at 6:21 AM, Andrea Aime <and...@ge...> wrote: On Fri, Nov 9, 2012 at 8:49 AM, Jody Garnett <jod...@gm...> wrote: > Looks like you need a reader that is thread safe - any recommendations? > > The only thing I can think of that would not break the thread safety contract would be that the reader does a full copy of the stream into an in memory byte[] and then works off it. Scary if you ask me, if someone by mistake points to a large content the OOM is just round the corner Cheers Andrea -- == Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- |
From: Jan T. <jan...@jt...> - 2012-11-09 10:05:26
|
Jody Garnett wrote: > Staging into a temp file would be smarter. That is my fallback approach currently. Does anyone know (Simone?) *why* the reader needs to be threadsafe or if it possible to derive a simpler version of the GeoTiffReader? I'm willing to change the source code and contribute back another reader but I couldn't find the crucial part in the code. I'd be nice to have a not in the javadoc that only File is supported, or better, change the Constructor. I have to admit that I'm still using GT 2.6.4 maybe things changed by now? Cheers, Jan |
From: Andrea A. <and...@ge...> - 2012-11-09 16:10:06
|
On Fri, Nov 9, 2012 at 11:05 AM, Jan Torben <jan...@jt...> wrote: > Jody Garnett wrote: > > > Staging into a temp file would be smarter. > That is my fallback approach currently. > > Does anyone know (Simone?) *why* the reader needs to be threadsafe or if it > possible to derive a simpler version of the GeoTiffReader? I'm willing to > change the source code and contribute back another reader but I couldn't > find the crucial part in the code. > Readers have to be thread safe because opening spatially referenced files is expensive, so the reader has to be reusable, the thread safety comes from web serving requirements where we have multiple requests coming in hitting the same data source, and they have to be able to work in parallel at the highest possible performance. Thus the requirements of re-usability and thread safety > > I'd be nice to have a not in the javadoc that only File is supported, or > better, change the Constructor. > > I have to admit that I'm still using GT 2.6.4 maybe things changed by now? > Nothing changed regarding the rules above. As said before, the only way I can think of to make the reader still work properly in your case is to have the client build a byte[] and have the code in the reader recognize that case and use the byte[] as the source. Cheers Andrea -- == Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- |
From: Jody G. <jod...@gm...> - 2012-11-11 06:29:14
|
I just figured out what is bothering me. Whatever is done amounts to a second cache. And I doubt it will be as good as JAI cache. So new recommendation - configure JAI tile cache setting to be big enough to hold your raster. -- Jody Garnett On 08/11/2012, at 3:19 PM, Jan Torben <jan...@jt...> wrote: > Hi, > > I have a GeoTiff URL and want to read it using GeoTiffReader. According to > http://jira.codehaus.org/browse/GEOT-3318 the reader needs a file, neither > InputStream nor any byte[] (ByteArrayInputStream) variant works. > > Is there any other way? Do you have an idea how I could fix that? I have to > read many files and want to avoid slow hard disk IO where possible. > > Cheers, > > Jan > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_nov > _______________________________________________ > GeoTools-GT2-Users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users |
From: Andrea A. <and...@ge...> - 2012-11-11 08:08:36
|
On Sun, Nov 11, 2012 at 7:29 AM, Jody Garnett <jod...@gm...>wrote: > I just figured out what is bothering me. > > Whatever is done amounts to a second cache. And I doubt it will be as > good as JAI cache. > Hmm... it's not a second cache, JAI tile cache only handles raw uncompressed imagery, not format specific data which has extra stuff like headers, compression, metadata and might or might not have a tile oriented structure at all. > > So new recommendation - configure JAI tile cache setting to be big > enough to hold your raster. > Will not work, the cache is dynamic, throws out tiles as you load other stuff in parallel or attach other JAI operations onto that source image We are talking two entirely different problems here: - one is being able to repeat reads in a thread safe way (using byte[]) - the other is avoiding recomputing tiles in a JAI operation chain (this is where the JAI tile cache is used) Cheers Andrea -- == Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- |
From: Andrea A. <and...@ge...> - 2012-11-11 19:35:16
|
On Sun, Nov 11, 2012 at 2:01 PM, Jan Torben <jan...@jt...> wrote: > On Sunday 11 November 2012 09:08:30 Andrea Aime wrote: > > - one is being able to repeat reads in a thread safe way (using byte[]) > > should it work using a ByteArrayInputStream(bytes) as argument? If yes, > then I > have another issue with the TIFF file maybe. > No, it should not. But the code could be modified to take a byte[] as the input without breaking its sematics Cheers Andrea -- == Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- |