Hi Greg, This isn't going to be an authoritative answer, I'm also just humble user ;-) but the way I achieve something similar is by using the OperationJAI class and the Histogram operation (have a look here as well http://www.nabble.com/First-cut-of-statistics-operations-(Histogram-and-Extrema)-td12389138.html ).
I do something along these lines GridCoverage coverage = reader.read(requestParams); OperationJAI op=new OperationJAI("Histogram"); ParameterValueGroup param = op.getParameters(); param.parameter("Source").setValue( coverage ); param.parameter("roi").setValue( roi ); GridCoverage2D histc = (GridCoverage2D) op.doOperation(param, null); Histogram hist = (Histogram) histc.getProperty("histogram"); int[] bins = hist.getBins(0); - where coverage is a GridCoverage obtained from reading the GeoTiff and roi is an ROIShape containing the query footprint. To some extent this code comes from examples online e.g. with the Histogram docs For the roi you will have to transform from the query footprint (i.e. the national boundary in your case) from world space to grid space. Note the grid space origin is top-left and it's integer. The easiest (laziest?) way to convert is to use the transformer on the coverage i.e. coverage.getGridGeometry().getGridToCRS().inverse(); and then round values to nearest int. I should add I've been working with discrete coverages rather than continuous ones so I think you'll need to do some other things to specify the ranges of the histogram bins...hopefully someone more experienced will chime in here. I've never used the select() method and from the docs don't entirely understand what it does, looking at the source code it appears to be unimplemented at the moment anyway. I need to do something similar in a bit so I'd be interesting hearing how you finally solve this. Cheers Alistair Greg Ederer wrote: > Hi, > > I have a shape file that defines national boundaries. I also have a > GeoTiff containing rainfall data. I want to obtain a collection of the > rainfall pixel values within a given national boundary. Is > Coverage.select() the correct method to use for this? > > Any suggestions greatly appreciated. > > Greg > > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users