EnglishFrenchSpanish

Ad


OnWorks favicon

r.thingrass - Online in the Cloud

Run r.thingrass in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command r.thingrass that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

PROGRAM:

NAME


r.thin - Thins non-null cells that denote linear features in a raster map layer.

KEYWORDS


raster, geometry

SYNOPSIS


r.thin
r.thin --help
r.thin input=name output=name [iterations=integer] [--overwrite] [--help] [--verbose]
[--quiet] [--ui]

Flags:
--overwrite
Allow output files to overwrite existing files

--help
Print usage summary

--verbose
Verbose module output

--quiet
Quiet module output

--ui
Force launching GUI dialog

Parameters:
input=name [required]
Name of input raster map

output=name [required]
Name for output raster map

iterations=integer
Maximal number of iterations
Default: 200

DESCRIPTION


r.thin scans the named input raster map layer and thins non-NULL cells that denote linear
features into linear features having a single cell width. Raster lines often need to be
thinned (skeletonizing raster features) to a single pixel width before they can be
transformed to vector data.

r.thin will thin only the non-NULL (no data) raster cells of the named input raster map
layer within the current geographic region settings. The cell width of the thinned output
raster map layer will be equal to the cell resolution of the currently set geographic
region. All of the thinned linear features will have the width of a single cell.

r.thin will create a new output raster data file containing the thinned linear features.
r.thin assumes that linear features are encoded with positive values on a background of
NULL’s in the input raster data file, hence it creates a NULL/1 output map.

NOTES


r.thin only creates raster map layers. In order to create a vector map, the user will need
to run r.to.vect on the resultant raster map.

r.thin may create small spurs or "dangling lines" during the thinning process. These
spurs may be removed (after creating a vector map layer) by v.clean (rmdangle tool).

This code implements the thinning algorithm described in "Analysis of Thinning Algorithms
Using Mathematical Morphology" by Ben-Kwei Jang and Ronlad T. Chin in Transactions on
Pattern Analysis and Machine Intelligence, vol. 12, No. 6, June 1990. The definition Jang
and Chin give of the thinning process is "successive removal of outer layers of pixels
from an object while retaining any pixels whose removal would alter the connectivity or
shorten the legs of the sceleton."

The sceleton is finally thinned when the thinning process converges; i.e., "no further
pixels can be removed without altering the connectivity or shortening the sceleton legs"
(p. 541). The authors prove that the thinning process described always converges and
produces one-pixel thick sceletons. The number of iterations depends on the original
thickness of the object. Each iteration peels off the outside pixels from the object.
Therefore, if the object is <= n pixels thick, the algorithm should converge in <=
iterations.

EXAMPLE


To vectorize the raster map streams_derived in the North Carolina sample dataset that
represents the stream network derived from the 10m resolution DEM by r.watershed, run:
g.region raster=elevation -p
# create flow accumulation map
r.watershed elevation=elevation accumulation=accum_50K thresh=50000
# extract streams from flow accumulation map
r.mapcalc "streams_from_flow = if(abs(accum_50K) > 1000, 1, null())"
# skeletonize map
r.thin streams_from_flow out=streams_thin
d.mon wx0
d.rast streams_from_flow
d.erase
d.rast streams_thin

Raster feature thinning (skeletonizing)

The resulting map cabe optionally vectorized:
r.to.vect streams_thin output=streams_thin type=line
# visualize
d.rast accum_50K
d.vect streams_thin color=red width=2

Vectorized stream network after thinning extracted from flow accumulation map

Use r.thingrass online using onworks.net services


Free Servers & Workstations

Download Windows & Linux apps

Linux commands

Ad