Ciao Martin,
see below....
-------------------------------------------------------
Ing. Simone Giannecchini
GeoSolutions S.A.S.
Founder - Software Engineer
Via Carignoni 51
55041  Camaiore (LU)
Italy

phone: +39 0584983027
fax:      +39 0584983027
mob:    +39 333 8128928


http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.linkedin.com/in/simonegiannecchini
http://twitter.com/simogeo

-------------------------------------------------------



On Wed, May 5, 2010 at 11:05 AM, Martin Tomko <[email protected]> wrote:
> Ok, I will try to summarize, and apply the snippet from Michael to my code -
> so far, I don't see many differences.
>
> So, I have:
> Input data:
> C:\dev\srtm38_03>gdalinfo srtm_38_03.tif
> Driver: GTiff/GeoTIFF
> Files: srtm_38_03.tif
>       srtm_38_03.aux
>       srtm_38_03.rrd
>       srtm_38_03.tfw
> Size is 6000, 6000
> Coordinate System is:
> GEOGCS["WGS 84",
>    DATUM["WGS_1984",
>        SPHEROID["WGS 84",6378137,298.257223563,
>            AUTHORITY["EPSG","7030"]],
>        AUTHORITY["EPSG","6326"]],
>    PRIMEM["Greenwich",0],
>    UNIT["degree",0.0174532925199433],
>    AUTHORITY["EPSG","4326"]]
> Origin = (5.000000000000000,50.000000000000000)
> Pixel Size = (0.000833333333333,-0.000833333333333)
> Metadata:
>  AREA_OR_POINT=Area
> Image Structure Metadata:
>  INTERLEAVE=BAND
> Corner Coordinates:
> Upper Left  (   5.0000000,  50.0000000) (  5d 0'0.00"E, 50d 0'0.00"N)
> Lower Left  (   5.0000000,  45.0000000) (  5d 0'0.00"E, 45d 0'0.00"N)
> Upper Right (  10.0000000,  50.0000000) ( 10d 0'0.00"E, 50d 0'0.00"N)
> Lower Right (  10.0000000,  45.0000000) ( 10d 0'0.00"E, 45d 0'0.00"N)
> Center      (   7.5000000,  47.5000000) (  7d30'0.00"E, 47d30'0.00"N)
> Band 1 Block=6000x1 Type=Int16, ColorInterp=Gray
>  Min=22.000 Max=4783.000
>  Minimum=22.000, Maximum=4783.000, Mean=684.078, StdDev=664.350
>  NoData Value=-32768
>  Overviews: 1500x1500, 750x750, 375x375, 188x188, 94x94, 47x47
>  Metadata:
>    STATISTICS_MINIMUM=22
>    STATISTICS_MAXIMUM=4783
>    STATISTICS_MEAN=684.07755619444
>    STATISTICS_MEDIAN=3.3377550846144e-307
>    STATISTICS_MODE=5.0068023903149e-308
>    STATISTICS_STDDEV=664.34981907181
>    LAYER_TYPE=athematic
>
> This seems not to be internally tiled.

Precisely, it is a striped tiff since as you can see from this line:

Block=6000x1

it is saved in stripes as large as the entire image but only 1 pixel tall.



>
> I have a class that, when constructed, does, amongst other, the following:
>        //initializes coverage
>        File file = new File("C:\\dev\\srtm38_03\\srtm_38_03.tif");
>        GeoTiffReader reader;
>        try {
>            reader = new GeoTiffReader(file);
>           DEMCOVERAGE = (GridCoverage2D) reader.read(null);
>           reader.dispose();
>            } catch (IOException ex) {
>                    ...
>            } catch (DataSourceException ex) {
>                    ...
>        }
>
> so, DEMCOVERAGE should, according to Simone, now point to the
> GrdiCoverage2D, but NOT be in memory, correct?
>
> later, I do:
>
>        ReferencedEnvelope renv = new
> ReferencedEnvelope(myPolygon.getEnvelopeInternal(),myCRS);
>
>        final AbstractProcessor processor = new DefaultProcessor(null);
>        final ParameterValueGroup param =
> processor.getOperation("CoverageCrop").getParameters();
>        param.parameter("Source").setValue( DEMCOVERAGE );
>        param.parameter("Envelope").setValue( renv );
>        GridCoverage2D cropped = (GridCoverage2D)
> processor.doOperation(param);
>
>
> So, that means, according to Simone, that I actually NEVER read the whole
> GridCoverage2D in, only the cropped one? Excellent!

Correct. You will load as many stripes as you need to fill out the
area you need. Notice that this might be a bit inefficient though with
respect to having a tiled geotiff.

Simone.

> Then, indeed, we HAVE
> the behaviour I was after, only it was not clear to me when it is read into
> memory. Maybe I should have done some memory profiling first...
>
> I am happy to help with documentation - peer reviewed, of course, so before
> I would write anything on the wiki, I would prefer if someone proof-read it
> first, not to confuse people.
> Cheers, thanks for all the help,
> Martin
>
> On 5/5/2010 10:43 AM, Simone Giannecchini wrote:
>>
>> Ciao Michael,
>> please see below...
>> -------------------------------------------------------
>> Ing. Simone Giannecchini
>> GeoSolutions S.A.S.
>> Founder - Software Engineer
>> Via Carignoni 51
>> 55041  Camaiore (LU)
>> Italy
>>
>> phone: +39 0584983027
>> fax:      +39 0584983027
>> mob:    +39 333 8128928
>>
>>
>> http://www.geo-solutions.it
>> http://geo-solutions.blogspot.com/
>> http://www.linkedin.com/in/simonegiannecchini
>> http://twitter.com/simogeo
>>
>> -------------------------------------------------------
>>
>>
>>
>> On Wed, May 5, 2010 at 10:36 AM, Michael Bedward
>> <[email protected]>  wrote:
>>
>>>
>>> Hi Simone,
>>>
>>> At some stage it would be great to get more of this stuff documented
>>> and possibly have some example apps. I must confess that a lot of it
>>> is still unknown territory to me.
>>>
>>
>> You are right, although I have to admit that finding time for this is
>> challenging. How do you suggest we should proceed?
>> I could fill up specific documentation templates if you have some
>> ideas already for topics you would like me to cover.
>>
>>
>>
>>>
>>> Meanwhile, for Martin's case, if his GeoTiffs are tiled, then will the
>>> following get him a cropped coverage without needing to read the whole
>>> image into memory ?
>>>
>>>        GridCoverage2D cov = reader.read(null);
>>>        Envelope2D cropEnv = new Envelope2D( crs, x, y, w, h );
>>>        DefaultProcessor processor = new DefaultProcessor(null);
>>>        ParameterValueGroup parameters =
>>> processor.getOperation("CoverageCrop").getParameters();
>>>        parameters.parameter("Source").setValue(cov);
>>>        parameters.parameter("Envelope").setValue(new
>>> Envelope2D(cropEnv));
>>>        GridCoverage2D croppedCov = (GridCoverage2D)
>>> processor.doOperation(parameters);
>>>
>>>
>>
>>  Yes, check the other example I sent.
>>
>> Simone.
>>
>>
>>>
>>> Michael
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> _______________________________________________
>>> Geotools-devel mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>>>
>>>
>>
>>
>
>
> --
> Martin Tomko
> Postdoctoral Research Assistant
>
> Geographic Information Systems Division
> Department of Geography
> University of Zurich - Irchel
> Winterthurerstr. 190
> CH-8057 Zurich, Switzerland
>
> email:  [email protected]
> site:   http://www.geo.uzh.ch/~mtomko
> mob:    +41-788 629 558
> tel:    +41-44-6355256
> fax:    +41-44-6356848
>
>
>

------------------------------------------------------------------------------
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to