Skip to content

r.out.kde

Exports raster with variable transparency into an image file

r.out.kde input=name background=name output=name [method=string] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

r.out.kde input=name background=name output=name

grass.script.run_command("r.out.kde", input, background, output, method=None, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("r.out.kde", input="name", background="name", output="name")

Parameters

input=name [required]
    Raster map to be rendered with semi-transparency
background=name [required]
    Background raster map
output=name [required]
    Rendered output file
method=string
    Method to scale transparency
    Allowed values: linear, logistic
--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
    Raster map to be rendered with semi-transparency
    Used as: input, raster, name
background : str, required
    Background raster map
    Used as: input, raster, name
output : str, required
    Rendered output file
    Used as: output, file, name
method : str, optional
    Method to scale transparency
    Allowed values: linear, logistic
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

r.out.kde creates an image file (e.g., PNG, JPG, or GIF) where the input raster is rendered on top of background raster with varying transparency based on the values of the input raster. This can be used for example for visualization of kernel density estimate (KDE).

With logistic method, values are scaled so that lower values are more transparent and higher values are more opaque than with linear scaling.

This module requires Python Imaging Library (already required for GRASS GIS).

EXAMPLE

In this example, we visualize KDE of schools on top of shaded relief map.

g.region raster=elevation
# create background map
r.relief input=elevation output=relief
# compute kernel density estimate
v.kernel input=schools_wake output=schools_density radius=4000 multiplier=1000000
r.colors map=schools_density color=bcyr
r.out.kde input=schools_density background=relief method=logistic output=output.png

image-alt

SEE ALSO

d.rast, v.kernel

Logistic function

AUTHOR

Anna Petrasova, NCSU GeoForAll Lab

SOURCE CODE

Available at: r.out.kde source code (history)
Latest change: Thursday Feb 20 13:02:26 2025 in commit 53de819