Re: [Geotools-gt2-users] Calculating zonal statistics for a grid coverage

2011-05-11 Thread Michael Bedward
Hi Nick, > Thanks for the code, it's exactly what I need and I have my program working. > I was just > wondering when I'll be able to get my hands on the ZonalStatistics class > through the geotools > distribution? At the moment I have copied Simone's ZonalStatistics class > source code > verba

Re: [Geotools-gt2-users] Calculating zonal statistics for a grid coverage

2011-05-11 Thread Nicolas Malleson
On 10 May 2011, at 23:04, Jody Garnett wrote: > gt-coverage contains the idea; the implementation for different formats is > handled as a plugins; so gt-geotiff contribtues the geotiff format. > gt-arcgrid contribtues the arcgrid format. > > Details here: > - http://docs.geotools.org/latest/us

Re: [Geotools-gt2-users] Calculating zonal statistics for a grid coverage

2011-05-10 Thread Jody Garnett
gt-coverage contains the idea; the implementation for different formats is handled as a plugins; so gt-geotiff contribtues the geotiff format. gt-arcgrid contribtues the arcgrid format. Details here: - http://docs.geotools.org/latest/userguide/welcome/geotools.html -- Jody Garnett On Wednesda

Re: [Geotools-gt2-users] Calculating zonal statistics for a grid coverage

2011-05-10 Thread Andrea Aime
On Tue, May 10, 2011 at 4:04 PM, Nicolas Malleson wrote: > I assume that the arcgrid module is part of gt-coverage? Or do I need to add > an additional module? It's in gt-coverage Cheers Andrea -- --- Ing. Andrea Aime GeoSolutions S.A.S. Tec

Re: [Geotools-gt2-users] Calculating zonal statistics for a grid coverage

2011-05-10 Thread Nicolas Malleson
On 10 May 2011, at 13:52, Andrea Aime wrote: > On Tue, May 10, 2011 at 11:54 AM, Nicolas Malleson > wrote: >> Can I just check, if you do "GridFormatFinder.getAvailableFormats()" do you >> also get an empty list? > > If I run that code from within the arcgrid module I get this: > > [org.geoto

Re: [Geotools-gt2-users] Calculating zonal statistics for a grid coverage

2011-05-10 Thread Andrea Aime
On Tue, May 10, 2011 at 11:54 AM, Nicolas Malleson wrote: > Can I just check, if you do "GridFormatFinder.getAvailableFormats()" do you > also get an empty list? If I run that code from within the arcgrid module I get this: [org.geotools.gce.arcgrid.ArcGridFormatFactory@1386000] If instead I r

Re: [Geotools-gt2-users] Calculating zonal statistics for a grid coverage

2011-05-10 Thread Nicolas Malleson
Hi Simone, On 10 May 2011, at 10:23, Simone Giannecchini wrote: > -1- makre sure this points to a fil that actually exists: File ascFile > = new File("data/leeds_dtm/raster.asc.gz"); Don't worry, I checked that first :-) > -2- make sure to provie a valid prj if your data is not in wgs84 The da

Re: [Geotools-gt2-users] Calculating zonal statistics for a grid coverage

2011-05-10 Thread Simone Giannecchini
Ciao Nick, two things: -1- makre sure this points to a fil that actually exists: File ascFile = new File("data/leeds_dtm/raster.asc.gz"); -2- make sure to provie a valid prj if your data is not in wgs84 Regards, Simone Giannecchini --- Ing. Simo

Re: [Geotools-gt2-users] Calculating zonal statistics for a grid coverage

2011-05-10 Thread Nicolas Malleson
Hi Simone, That's what I was doing originally (only tried zipping it because it was in Jody's example) but the behaviour was the same. Kind regards, Nick On 10 May 2011, at 09:56, Simone Giannecchini wrote: > I would unzip the file before using it. > Performances would be horrible anyway. > >

Re: [Geotools-gt2-users] Calculating zonal statistics for a grid coverage

2011-05-10 Thread Simone Giannecchini
I would unzip the file before using it. Performances would be horrible anyway. Regards, Simone Giannecchini --- Ing. Simone Giannecchini GeoSolutions S.A.S. Founder Via Poggio alle Viti 1187 55054  Massarosa (LU) Italy phone: +39 0584 962313 fa

Re: [Geotools-gt2-users] Calculating zonal statistics for a grid coverage

2011-05-10 Thread Nicolas Malleson
Thanks for all the help with the zonal statistics, I was amazed to wake up this morning with 5 replies! I'll have a look at the jai tools that Michael and Simone have recommended this afternoon, but in the meantime I'd just like to ask about the behaviour of the GridFormatFinder (the behaviour o

Re: [Geotools-gt2-users] Calculating zonal statistics for a grid coverage

2011-05-10 Thread Simone Giannecchini
Ciao A tutti, aside from what jody just said for reading an asci grid, I just committed these days the zonalstats operation wrapper from jai-tools inside geotools. This means that you should be able to get the relevant jars for reading the ascigrid, and then computing statistics using the zonal st

Re: [Geotools-gt2-users] Calculating zonal statistics for a grid coverage

2011-05-09 Thread Michael Bedward
Hello Nick, I see that Jody has already given some advice about reading the data source and Andy has chipped in with some good points about vector / raster issues. GeoTools includes an unsupported module, gt-jai-tools, which wraps the ZonalStats image operation from the JAI-tools project: http:/

Re: [Geotools-gt2-users] Calculating zonal statistics for a grid coverage

2011-05-09 Thread Jody Garnett
I did a quick test with the normal GridFormatFinder and it works to read ArcGrid ASCII: final File f = TestData.file(this, "ArcGrid.asc"); // Reading the coverage through a file AbstractGridFormat format = GridFormatFinder.findFormat( f ); AbstractGridCoverage2DReader reader = format.getReader

Re: [Geotools-gt2-users] Calculating zonal statistics for a grid coverage

2011-05-09 Thread Jody Garnett
There was a commit yesterday about ZonalStats; I would start with looking at the test cases for it. The ArcGrid plugin reads some kind of ascii format? http://docs.geotools.org/latest/userguide/library/coverage/arcgrid.html I have not hunted down an example yet; need to look in test cases; here

Re: [Geotools-gt2-users] Calculating zonal statistics for a grid coverage

2011-05-09 Thread Andy Turner
t any GeoTools implementations of this, but I'm interested. Cheers, Andy From: Nick Malleson [n.malleso...@leeds.ac.uk] Sent: 09 May 2011 19:37 To: geotools-gt2-users@lists.sourceforge.net Subject: [Geotools-gt2-users] Calculating zonal statistics for a grid

[Geotools-gt2-users] Calculating zonal statistics for a grid coverage

2011-05-09 Thread Nick Malleson
Hi, I was wondering if anyone has some advice about calculating zonal statistics from a raster file. Basically I have a raster DTM and a polygon shapefile and I want to calculate, for each area in the shapefile, the average height values of all pixels within that area. (Exactly the same thing that