Skip to content

v.perturb

Random location perturbations of vector points.

v.perturb [-sb] input=name [layer=string] output=name [distribution=string] parameters=float [,float,...] [minimum=float] [seed=integer] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

v.perturb input=name output=name parameters=float seed=integer

grass.script.run_command("v.perturb", input, layer="-1", output, distribution="uniform", parameters, minimum=0.0, seed=None, flags=None, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("v.perturb", input="name", output="name", parameters=float, seed=integer)

Parameters

input=name [required]
    Name of input vector map
    Or data source for direct OGR access
layer=string
    Layer number or name ('-1' for all layers)
    A single vector map can be connected to multiple database tables. This number determines which table to use. When used with direct OGR access this is the layer name.
    Default: -1
output=name [required]
    Name for output vector map
distribution=string
    Distribution of perturbation
    Allowed values: uniform, normal
    Default: uniform
parameters=float [,float,...] [required]
    Parameter(s) of distribution
    If the distribution is uniform, only one parameter, the maximum, is needed. For a normal distribution, two parameters, the mean and standard deviation, are required.
minimum=float
    Minimum deviation in map units
    Default: 0.0
seed=integer
    Seed value for the random number generator
    Using the same seed ensures identical results, while a randomly generated seed produces different outcomes in each run.
-s
    Generate random seed (result is non-deterministic)
-b
    Do not build topology
    Advantageous when handling a large number of points
--overwrite
    Allow output files to overwrite existing files
--help
    Print usage summary
--verbose
    Verbose module output
--quiet
    Quiet module output
--qq
    Very quiet module output
--ui
    Force launching GUI dialog

input : str, required
    Name of input vector map
    Or data source for direct OGR access
    Used as: input, vector, name
layer : str, optional
    Layer number or name ('-1' for all layers)
    A single vector map can be connected to multiple database tables. This number determines which table to use. When used with direct OGR access this is the layer name.
    Used as: input, layer
    Default: -1
output : str, required
    Name for output vector map
    Used as: output, vector, name
distribution : str, optional
    Distribution of perturbation
    Allowed values: uniform, normal
    Default: uniform
parameters : float | list[float] | str, required
    Parameter(s) of distribution
    If the distribution is uniform, only one parameter, the maximum, is needed. For a normal distribution, two parameters, the mean and standard deviation, are required.
minimum : float, optional
    Minimum deviation in map units
    Default: 0.0
seed : int, optional
    Seed value for the random number generator
    Using the same seed ensures identical results, while a randomly generated seed produces different outcomes in each run.
flags : str, optional
    Allowed values: s, b
    s
        Generate random seed (result is non-deterministic)
    b
        Do not build topology
        Advantageous when handling a large number of points
overwrite: bool, optional
    Allow output files to overwrite existing files
    Default: False
verbose: bool, optional
    Verbose module output
    Default: False
quiet: bool, optional
    Quiet module output
    Default: False
superquiet: bool, optional
    Very quiet module output
    Default: False

DESCRIPTION

v.perturb reads a vector map of points and writes the same points but perturbs the eastings and northings by adding either a uniform or normal delta value. Perturbation means that a variating spatial deviation is added to the coordinates.

NOTES

The uniform distribution is always centered about zero. The associated parameter is constrained to be positive and specifies the maximum of the distribution; the minimum is the negation of that parameter. Do perturb into a ring around the center, the minimum parameter can be used.

Usually, the mean (first parameter) of the normal distribution is zero (i.e., the distribution is centered at zero). The standard deviation (second parameter) is naturally constrained to be positive.

Output vector points are not guaranteed to be contained within the current geographic region.

EXAMPLES

Random, uniformly distributed selection

To create a random, uniformly distributed selection of possible new points with a radius of 100,000 map units, use the following command:

v.perturb input=comm_colleges output=uniform_perturb parameters=100000

Your map should look similar to this figure:

v.perturb uniform distribution example
Figure: Map showing the actual community college points and uniformly random chosen points.

Normal distributed selection

For a normal distribution with a mean of 5000 and standard deviation of 2000, use the following command:

v.perturb input=comm_colleges output=normal_perturb distribution=normal parameters=5000,2000

v.perturb normal distribution example
Figure: Map showing the actual community college points and normally random chosen and colored points. Notice that each point is closer to the original point.

Normal distributed selection with a minimum value

In order to include a minimum value of 500, use the following command:

v.perturb input=comm_colleges output=min_perturb distribution=normal parameters=100000,1000 minimum=500

SEE ALSO

v.random, v.univar

AUTHORS

James Darrell McCauley
when he was at: Agricultural Engineering Purdue University

Random number generators originally written in FORTRAN by Wes Peterson and translated to C using f2c.

SOURCE CODE

Available at: v.perturb source code (history)
Latest change: Thursday Mar 06 19:23:31 2025 in commit 5fd4234