Hi Andrea,
I think that you can start from this example:
https://github.com/geotools/geotools/blob/main/modules/plugin/geotiff/src/test/java/org/geotools/gce/geotiff/GeoTiffReaderCogOnlineTest.java#L46

Just make sure to define a reduced envelope when setting up the
requestedGridGeometry parameter so that it will only access the needed
ranges to populate the requested envelope.

This section was setting same envelope but smaller raster area, to involve
overviews:
https://github.com/geotools/geotools/blob/main/modules/plugin/geotiff/src/test/java/org/geotools/gce/geotiff/GeoTiffReaderCogOnlineTest.java#L100

You can arrange it to actually request a cropped envelope with a fitting
raster.
At that point it should only read the ranges involved to get those tiles.

Please, let us know if you still have issues.

Regards,

Daniele Romagnoli

==
GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.
==

Daniele Romagnoli
Senior Software Engineer

GeoSolutions Group
phone: +39 0584 962313
fax:      +39 0584 1660272

https://www.geosolutionsgroup.com/
http://twitter.com/geosolutions_it
-------------------------------------------------------

Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE
2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si
precisa che ogni circostanza inerente alla presente email (il suo
contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è
riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il
messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra
operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is
addressed and may contain information that is privileged, confidential or
otherwise protected from disclosure. We remind that - as provided by
European Regulation 2016/679 “GDPR” - copying, dissemination or use of this
e-mail or the information herein by anyone other than the intended
recipient is prohibited. If you have received this email by mistake, please
notify us immediately by telephone or e-mail.


On Tue, Sep 6, 2022 at 3:27 PM andrea antonello <andrea.antone...@gmail.com>
wrote:

> > > The s3-geotiff module is not doing range reads, it can read any tiff,
> even non cog, and does read blocks of 5MB caching them on disk.
> > >
> > > Full COG support is built into the gt-geotiff module... But has
> currently no caching and requires COG layout. You should find an example of
> usage among the tests.
> >
> > oh, I see, thank you so much. Will check that out.
>
> I am not sure what you mean by COG layout. I couldn't find any
> reference in the testcases or source code.
> I am assuming it should be set inside the GeneralParameters part?
> Right now using "standard" general parameters I again get the coverage
> of the complete tiff instead of a range of it.
>
> Even if setting the source SPI provider to (as seen in the test):
>
> String url = "
> https://minio.myinstance.org/cogs/eu_dem_v22_itnord4326_cog512.tif";;
> BasicAuthURI cogUri = new BasicAuthURI(url, false);
> HttpRangeReader rangeReader = new HttpRangeReader(cogUri.getUri(),
> CogImageReadParam.DEFAULT_HEADER_LENGTH);
> CogSourceSPIProvider input = new CogSourceSPIProvider(cogUri, new
> CogImageReaderSpi(), new CogImageInputStreamSpi(),
> rangeReader.getClass().getName());
>
> Do you happen to have an example that uses COG layout?
>
> Thanks a lot,
> Andrea
>
>
>
>
> > > Il Mar 6 Set 2022, 09:46 andrea antonello <andrea.antone...@gmail.com>
> ha scritto:
> > >>
> > >> Hello,
> > >> I wanted to test the s3 geotiff module to read cogs from a minio
> instance.
> > >>
> > >> It was actually quite simple to set up, but I have not been able to do
> > >> range requests.
> > >> The whole image seems to be read every time instead.
> > >>
> > >> Can anyone with experience tell me what I might be doing wrong?
> > >>
> > >> My super simple code is this:
> > >>
> > >> System.setProperty("s3.properties.location",
> "/path/to/s3.properties");
> > >> S3GeoTiffReader reader = new S3GeoTiffReader(new
> > >>
> S3ImageInputStreamImpl("main://cogs/eu_dem_v22_itnord4326_cog512.tif"));
> > >> GeneralParameterValue[] generalParameter = // omitting the creation of
> > >> GP using the bounds values and resolution
> > >> GridCoverage2D coverage2D = reader.read(generalParameter);
> > >>
> > >> Is the use of generalParameter the right way to address this?
> > >>
> > >> Thanks for any hint,
> > >> Andrea
> > >>
> > >>
> > >> _______________________________________________
> > >> GeoTools-GT2-Users mailing list
> > >> GeoTools-GT2-Users@lists.sourceforge.net
> > >> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to