[GRASS-dev] v.perturb

Dear GRASS GIS developers,

I am planning to use v.perturb to run a spatial simulated annealing exercise. Two drawbacks with v.perturb exist. First, “output vector points are not guaranteed to be contained within the current geographic region”. Second, all vector points are perturbed together.

Is it very difficult to solve this issues?

Another option for perturbation would be v.edit, but in that case the direction and distance are not random.

Best,

Alessandro Samuel-Rosa

Graduate School in Agronomy - Soil Science
Federal Rural University of Rio de Janeiro
Seropédica, Rio de Janeiro, Brazil

Guest Researcher at ISRIC - World Soil Information
Wageningen, the Netherlands

Homepage: soil-scientist.net Skype: alessandrosamuel

On 27/08/14 00:12, Alessandro Samuel Rosa wrote:

Dear GRASS GIS developers,

I am planning to use v.perturb to run a spatial simulated annealing
exercise. Two drawbacks with v.perturb exist. First, "output vector
points are not guaranteed to be contained within the current geographic
region". Second, all vector points are perturbed together.

Is it very difficult to solve this issues?

What exactly are your objectives ?

You can use v.extract with the random= option or v.kcv+v.extract to create a sample of points you can then perturb instead of perturbing all points.

To make sure your points still fall into the region, you can use v.in.region to create a polygon representing the region, then v.select within your sample those that fall into the polygon.

Moritz

My objective is to perform a spatial simulated annealing schedule. It works as follows:

  1. generate a set of n points randomly positioned in the study area (v.random);
  2. query values from raster maps (r.what);
  3. calculate an statistic;
  4. randomly perturb one randomly selected point;
  • the point has to fall withing the study area;
  1. go through 2-4 till the statistic meets a given criterion.

Ideally, v.perturb would do step 4: allow for perturbing a single point and check if it still falls inside the study area. If the point falls outside the study area, then it should be forced to the closest position within the study area.

Alessandro Samuel-Rosa

Graduate School in Agronomy - Soil Science
Federal Rural University of Rio de Janeiro
Seropédica, Rio de Janeiro, Brazil

Guest Researcher at ISRIC - World Soil Information
Wageningen, the Netherlands

Homepage: soil-scientist.net Skype: alessandrosamuel

Em Quinta-feira, 28 de Agosto de 2014 13:49, Moritz Lennert mlennert@club.worldonline.be escreveu:

On 27/08/14 00:12, Alessandro Samuel Rosa wrote:

Dear GRASS GIS developers,

I am planning to use v.perturb to run a spatial simulated annealing
exercise. Two drawbacks with v.perturb exist. First, “output vector
points are not guaranteed to be contained within the current geographic
region”. Second, all vector points are perturbed together.

Is it very difficult to solve this issues?

What exactly are your objectives ?

You can use v.extract with the random= option or v.kcv+v.extract to
create a sample of points you can then perturb instead of perturbing all

points.

To make sure your points still fall into the region, you can use
v.in.region to create a polygon representing the region, then v.select
within your sample those that fall into the polygon.

Moritz

On 28/08/14 14:55, Alessandro Samuel Rosa wrote:

My objective is to perform a spatial simulated annealing schedule. It
works as follows:

1) generate a set of n points randomly positioned in the study area
(v.random);
2) query values from raster maps (r.what);
3) calculate an statistic;
4) randomly perturb one randomly selected point;
    - the point has to fall withing the study area;
5) go through 2-4 till the statistic meets a given criterion.

Ideally, v.perturb would do step 4: allow for perturbing a single point
and check if it still falls inside the study area. If the point falls
outside the study area, then it should be forced to the closest position
within the study area.

Until someone adds this functionality to v.perturb, you could just use a loop like this:

- v.extract your point (possibly v.extract -r the other points)
- perturb extracted point
- while point outside region (you can check either mathematically using the points coordinates that you can get via v.to.db or you can use v.select the point with the region polygon and check whether the result is empty or no)
  - perturb the point again

Moritz

I will follow your suggestion as far such functionality is not implemented in v.perturb.

Alessandro Samuel-Rosa

Graduate School in Agronomy - Soil Science
Federal Rural University of Rio de Janeiro
Seropédica, Rio de Janeiro, Brazil

Guest Researcher at ISRIC - World Soil Information
Wageningen, the Netherlands

Homepage: soil-scientist.net Skype: alessandrosamuel

Em Quinta-feira, 28 de Agosto de 2014 15:09, Moritz Lennert mlennert@club.worldonline.be escreveu:

On 28/08/14 14:55, Alessandro Samuel Rosa wrote:

My objective is to perform a spatial simulated annealing schedule. It
works as follows:

  1. generate a set of n points randomly positioned in the study area
    (v.random);
  2. query values from raster maps (r.what);
  3. calculate an statistic;
  4. randomly perturb one randomly selected point;
  • the point has to fall withing the study area;
  1. go through 2-4 till the statistic meets a given criterion.

Ideally, v.perturb would do step 4: allow for perturbing a single point
and check if it still falls inside the study area. If the point falls
outside the study area, then it should be forced to the closest position
within the study area.

Until someone adds this functionality to v.perturb, you could just use a
loop like this:

  • v.extract your point (possibly v.extract -r the other points)
  • perturb extracted point
  • while point outside region (you can check either mathematically using
    the points coordinates that you can get via v.to.db or you can use
    v.select the point with the region polygon and check whether the result
    is empty or no)
  • perturb the point again

Moritz

On 28/08/14 16:02, Alessandro Samuel Rosa wrote:

I will follow your suggestion as far such functionality is not
implemented in v.perturb.

Attached a very crude and untested attempt at a region check. If you can compile GRASS, you could try to see if it works. It should probably be made conditional on a flag as most people would not expect a vector module to take region settings into account.

You can also file an enhancement request in the GRASS Trac.

Moritz

(attachments)

perturb_regioncheck.diff (1.26 KB)

On Aug 27, 2014 12:12 AM, “Alessandro Samuel Rosa” <alessandrosamuel@yahoo.com.br> wrote:

Dear GRASS GIS developers,

I am planning to use v.perturb to run a spatial simulated annealing exercise. Two drawbacks with v.perturb exist. First, “output vector points are not guaranteed to be contained within the current geographic region”.

The command v.random got recently improved to optionally constrain points being generated to a restricted area. Not sure if this method could be implemented here as well.
Did you test how far outside points may fall?

Second, all vector points are perturbed together.

Here a “where” statement would help, to be implemented…

Markus

Is it very difficult to solve this issues?

Another option for perturbation would be v.edit, but in that case the direction and distance are not random.

Best,

Alessandro Samuel-Rosa

Graduate School in Agronomy - Soil Science
Federal Rural University of Rio de Janeiro
Seropédica, Rio de Janeiro, Brazil

Guest Researcher at ISRIC - World Soil Information
Wageningen, the Netherlands

Homepage: soil-scientist.net Skype: alessandrosamuel


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

The place where a point will fall depends on the arguments “distribution” and “parameters”. In spatial simulated annealing we start allowing a point to be shifted (perturbed) to any location within the study area. As the iterations go on, we constrain the amount of shifting to shorter distances.

Regarding v.random: could you please include a description in the help page on how the restriction is done? This is an extremely important information.

Alessandro Samuel-Rosa

Graduate School in Agronomy - Soil Science
Federal Rural University of Rio de Janeiro
Seropédica, Rio de Janeiro, Brazil

Guest Researcher at ISRIC - World Soil Information
Wageningen, the Netherlands

Homepage: soil-scientist.net Skype: alessandrosamuel

Em Quinta-feira, 28 de Agosto de 2014 17:28, Markus Neteler neteler@osgeo.org escreveu:

On Aug 27, 2014 12:12 AM, “Alessandro Samuel Rosa” <alessandrosamuel@yahoo.com.br> wrote:

Dear GRASS GIS developers,

I am planning to use v.perturb to run a spatial simulated annealing exercise. Two drawbacks with v.perturb exist. First, “output vector points are not guaranteed to be contained within the current geographic region”.
The command v.random got recently improved to optionally constrain points being generated to a restricted area. Not sure if this method could be implemented here as well.
Did you test how far outside points may fall?
Second, all vector points are perturbed together.
Here a “where” statement would help, to be implemented…
Markus
Is it very difficult to solve this issues?

Another option for perturbation would be v.edit, but in that case the direction and distance are not random.

Best,

Alessandro Samuel-Rosa

Graduate School in Agronomy - Soil Science
Federal Rural University of Rio de Janeiro
Seropédica, Rio de Janeiro, Brazil

Guest Researcher at ISRIC - World Soil Information
Wageningen, the Netherlands

Homepage: soil-scientist.net Skype: alessandrosamuel


grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

On Fri, Aug 29, 2014 at 8:37 AM, Alessandro Samuel Rosa
<alessandrosamuel@yahoo.com.br> wrote:

Regarding v.random: could you please include a description in the help page
on how the restriction is done? This is an extremely important information.

It is all there:
http://grass.osgeo.org/grass70/manuals/v.random.html#restriction-to-vector-areas

Markus