Hi Daniele,
thanks for your reply. I have no way to share my data, it would be a 
rather big pack. I created a mosaic of a srtm dem (geotiff), and 
therefore have a shpfile index. That is the input file in the code I 
posted previously.
I successfully read the whole geotiff using a geotiff reader, where I 
can get the nodata value using the
reader = new GeoTiffReader(file);
rasterNodata = reader.getMetadata().getNoData();

code. I need to do something similar when I read it from a shapefile. I 
don't think you can use the geotifff reader with the mosaic index 
shapefile input, right? That's why I used the approach mentioned. Works 
fine, but I need to extract the nodata parameter, which I thought will 
be hidden among the metadatanames/values. After digging through the 
javadoc, I still see the method mentioned there: 
http://javadoc.geotools.fr/2.5/org/geotools/coverage/grid/io/AbstractGridCoverage2DReader.html#getMetadataNames()
And eclipse still offers the method.

Thanks
Martin


Daniele Romagnoli wrote:
> Hi Martin,
> the getMetadataNames is not supported in the 
> AbstractGridCoverage2DReader nor in the GeoTiffReader or 
> ImageMosaicReader.
>
> Anyway, what do you exactly mean with "Tiled tiff"?
> Do you have a single "internally tiled" tiff file or do you have 
> several tiff files representing tiles of an image mosaic?
> In the first case, I suggest to you to use the GeoTIFF reader.
> Do you have any chance to share your data so I can check it?
>
> Regards,
> Daniele
>
>
> On Wed, Feb 18, 2009 at 10:53 AM, Martin Tomko 
> <[email protected] <mailto:[email protected]>> wrote:
>
>     Dear all,
>     in current 2.5-Snapshot, I am unable to read metadata of a tiled tiff,
>     read using the code below. Reading the javadoc, the operation
>     should be
>     supported. I am trying to get access to the nodata parameter,
>     achievieng
>     something similar to the geotiff reader's
>     reader.getMetadata().getNoData();
>     Is there any other way?
>     Thanks
>     Martin
>
>     AbstractGridCoverage2DReader reader;
>                ImageMosaicFormatFactory imfFact = new
>     ImageMosaicFormatFactory();
>                format = (ImageMosaicFormat) imfFact.createFormat();
>                if (format.accepts(file)){
>                    reader = (ImageMosaicReader)  format.getReader(file);
>     format.getReader(file);
>                    String[] metas = reader.getMetadataNames();
>
>                    for (int i=0;i<metas.length;i++){
>                        System.out.println(metas[i]);
>                    }
>                    try {
>
>                        coverage = (GridCoverage2D) reader.read(null);
>                        reader.dispose();
>                    } catch (IOException ex) {
>                        ex.printStackTrace();
>                        return;
>                    }
>
>
>     
> ------------------------------------------------------------------------------
>     Open Source Business Conference (OSBC), March 24-25, 2009, San
>     Francisco, CA
>     -OSBC tackles the biggest issue in open source: Open Sourcing the
>     Enterprise
>     -Strategies to boost innovation and cut costs with open source
>     participation
>     -Receive a $600 discount off the registration fee with the source
>     code: SFAD
>     http://p.sf.net/sfu/XcvMzF8H
>     _______________________________________________
>     Geotools-gt2-users mailing list
>     [email protected]
>     <mailto:[email protected]>
>     https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
>
>
> -- 
> -------------------------------------------------------
> Eng. Daniele Romagnoli
> Software Engineer
>
> GeoSolutions S.A.S.
> Via Carignoni 51
> 55041 Camaiore (LU)
> Italy
>
> phone: +39 0584983027
> fax:     +39 0584983027
> mob:   +39 328 0559267
>
>
> http://www.geo-solutions.it
>
> -------------------------------------------------------
>


-- 
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


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to