[GRASS-user] Selecting n cells more then minDist apart
Hamish
hamish_b at yahoo.com
Thu Jan 26 15:45:32 EST 2012
Rainer wrote:
> I need to select n cells on a raster map with no
> cell closer then minDist from any other selected
> cell. The distances can be larger - no problem -
out to infinity?
> but they must not be smaller then minDist.
>
> I looked at r.random.cell with using distance= as
> the min distance, but if I select randomly n
> cells from the set generated, I get cells
> with a multiple of minDist apart - not exactly
> what I am looking for.
>
> I could use r.random and iterate until my
> requirements are met, but that strikes me as
> extremely inefficient. Are thare any other ways of
> achieving this?
you might try to prepare a legal-zone mask with
v.buffer + v.overlay, then try e.g. the
v.random.cover addon module:
http://grass.osgeo.org/wiki/GRASS_AddOns#v.random.cover
"Randomly generate a 2D points map constrained to an area"
See also 'r.random cover= vector_output='"
(no escape from "iterate until my requirements are met", but it's as efficient as it can be)
Hamish
More information about the grass-user
mailing list