1r.distance(1)               GRASS GIS User's Manual              r.distance(1)
2
3
4

NAME

6       r.distance   - Locates the closest points between objects in two raster
7       maps.
8

KEYWORDS

10       raster, distance
11

SYNOPSIS

13       r.distance
14       r.distance --help
15       r.distance [-lon] map=name1,name2[,name1,name2,...]  [separator=charac‐
16       ter]   [sort=string]   [--help]  [--verbose]  [--quiet]  [--ui]
17
18   Flags:
19       -l
20           Include category labels in the output
21
22       -o
23           Report zero distance if rasters are overlapping
24
25       -n
26           Report null objects as *
27
28       --help
29           Print usage summary
30
31       --verbose
32           Verbose module output
33
34       --quiet
35           Quiet module output
36
37       --ui
38           Force launching GUI dialog
39
40   Parameters:
41       map=name1,name2[,name1,name2,...] [required]
42           Name of two input raster maps for computing inter-class distances
43
44       separator=character
45           Field separator
46           Special characters: pipe, comma, space, tab, newline
47           Default: :
48
49       sort=string
50           Sort output by distance
51           Default: sorted by categories
52           Options: asc, desc
53           asc: Sort by distance in ascending order
54           desc: Sort by distance in descending order
55

DESCRIPTION

57       r.distance  locates  the closest points between "objects" in two raster
58       maps.  An "object" is defined as all the grid cells that have the  same
59       category  number, and closest means having the shortest "straight-line"
60       distance.  The cell centers are considered for the distance calculation
61       (two adjacent grid cells have the distance between their cell centers).
62
63       The  output is an ascii list, one line per pair of objects, in the fol‐
64       lowing form:
65       cat1:cat2:distance:east1:north1:east2:north2
66
67       cat1
68           Category number from map1
69
70       cat2
71           Category number from map2
72
73       distance
74           The distance in meters between "cat1" and "cat2"
75
76       east1,north1
77           The coordinates of the grid cell "cat1" which is closest to "cat2"
78
79       east2,north2
80           The coordinates of the grid cell "cat2" which is closest to "cat1"
81
82   Flags
83       -l The -l flag outputs the category labels of the  matched  raster  ob‐
84       jects at the beginning of the line, if they exist.
85
86       -o  The -o flag reports zero distance if the input rasters are overlap‐
87       ping.
88

NOTES

90       The output format lends itself to filtering.   For  example,  to  "see"
91       lines  connecting  each  of  the category pairs in two maps, filter the
92       output using awk and then into d.graph:
93
94       r.distance map=map1,map2 | \
95         awk -F: ’{print "move",$4,$5,"\ndraw",$6,$7}’ | d.graph -m
96
97       To create a vector map of all the "map1" coordinates, filter the output
98       into awk and then into v.in.ascii:
99
100       r.distance map=map1,map2 | \
101         awk -F: ’{print $4,$5}’ | v.in.ascii format=point output=name separator=space
102

SEE ALSO

104        r.buffer, r.cost, r.drain, r.grow, r.grow.distance, v.distance
105

AUTHOR

107       Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
108

SOURCE CODE

110       Available at: r.distance source code (history)
111
112       Accessed: Mon Jun 20 16:46:01 2022
113
114       Main  index  | Raster index | Topics index | Keywords index | Graphical
115       index | Full index
116
117       © 2003-2022 GRASS Development Team, GRASS GIS 8.2.0 Reference Manual
118
119
120
121GRASS 8.2.0                                                      r.distance(1)
Impressum