Good afternoon, I would like to share my tests up to now, maybe someone is interested :-)
My first try has been to plug in at the RenderedImage level. To do that I had to: * extend DataBuffer since the GridCoverage creation seems to pass through the databuffer methods and also requests the databanks to be accessible upon creation (didn't expect that one, since the method is not even API and it may force someone to do an unnecessary data unboxing) * create a raster using the DataBuffer and a ComponentSampleModel (I am right now trying to see if it works with single band mode, so that one should be ok) * then I can use the raster to create a RenderedImage, WrapperRI seems to be my friend here. Just needed to extend it to implement the getData methods: DataBuffer db = *new* MyFloatBuffer(mySource); Raster raster = Raster.*createRaster*(sm, db, null); MyWrapperRI ri = *new* MyWrapperRI(raster); * with that at hand I have been able to create my wrapped gridcoverage like: GridCoverageFactory factory = CoverageFactoryFinder. *getGridCoverageFactory*(*null*); GridCoverage2D coverage = factory.create("myraster", ri, envelope); And it seems to work quite nicely. Can you think of any objection to this workflow? Cheers, Andrea On Thu, Jan 21, 2021 at 3:33 PM andrea antonello <andrea.antone...@gmail.com> wrote: > Good afternoon, > I have a best practice question. > I am interfacing an object from a 3rd party software that represents a > raster grid (similar to a netcdf, which can be many things) and I would > like to render it as gridcoverage2d. Converting it into a gridcoverage is a > bit of a bottleneck, since I'd have to pass through all the data. > What would my best bet be? I am thinking of trying to wrap it inside a > GridCoverage2D and implement all necessary methods. > > Does anyone have experiences to share about this? > > Thanks in advance, > Andrea > > >
_______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users