Hi Barry, > Can you explain a bit more about your problem? > * What are the inputs? Just a grid of values or are there some starting points?
Inputs is a floating grid. Starting point is 1) the highest values in the grid. Once first accumulation achieved, exclude this area and 2) find highest value on grid for next starting points and so on. > * What are the outputs? A list of grid cells that add up to your accumulated value? outputs: accumulation areas where sum of grid points (within areas) is a given value. Does that clarify? Cheers Herry -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Barry Rowlingson Sent: Thursday, July 31, 2008 7:09 PM To: Herr, Alexander Herr - Herry (CSE, Gungahlin) Cc: r-sig-geo@stat.math.ethz.ch Subject: Re: [R-sig-Geo] accumulate gridcells to a specific value 2008/7/31 <[EMAIL PROTECTED]>: > I am trying to accumulate gridcells to a specific value. This means I > need to extent the nearest neighbours (or search radius) to a size so > that the sum of gridcell values reaches the desired value (or stops if > sum value of gridcells/radius goes beyond a specific size). It should > start with the highest gridcell value then next remaining highest etc. > > Of course this could also work with points/polygons or on a matrix. > > Rather than re-inventing the wheel I was wondering if anyone has or > knows of a tool/script. It's not totally clear what you want to do, but it sounds like the sort of raster operation that GRASS GIS does. http://grass.itc.it/ Can you explain a bit more about your problem? * What are the inputs? Just a grid of values or are there some starting points? * What are the outputs? A list of grid cells that add up to your accumulated value? I ask this because this week I wrote some code that did something very similar, namely: Given a grid of resource values and a number of population centres, compute the areas on the grid that allocate a given resource total to each population centre by minimising the distance from each centre, and not allowing any grid square to be allocated to more than one centre. It basically grows areas out from the centres, by finding the minimum centre-resource cell distance for unallocated cells and allocating that cell to that centre. This was written in Python and used gdal to read grids. Took me a day to write and a day to document. I'll have to start charging for this :) Barry _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo