1r.distance(1) Grass User's Manual r.distance(1)
2
3
4
6 r.distance - Locates the closest points between objects in two raster
7 maps.
8
10 raster
11
13 r.distance
14 r.distance help
15 r.distance [-loq] maps=map1,map2 [fs=string] [--verbose] [--quiet]
16
17 Flags:
18 -l
19 Include category labels in the output
20
21 -o
22 Report zero distance if rasters are overlapping
23
24 -q
25 Run quietly
26
27 --verbose
28 Verbose module output
29
30 --quiet
31 Quiet module output
32
33 Parameters:
34 maps=map1,map2
35 Maps for computing inter-class distances
36
37 fs=string
38 Output field separator
39 Default: :
40
42 Locates the closest points between "objects" in two raster maps. An
43 "object" is defined as all the grid cells that have the same category
44 number, and closest means having the shortest "straight-line" distance.
45 The cell centers are considered for the distance calculation (two adja‐
46 cent grid cells have the distance between their cell centers).
47
48 The output is an ascii list, one line per pair of objects
49 cat1:cat2:distance:east1:north1:east2:north2
50
51
52 Explanation:
53 cat1
54 Category number from map1
55
56 cat2
57 Category number from map2
58
59 distance
60 The distance in meters between "cat1" and "cat2"
61
62 east1,north1
63 The coordinates of the grid cell "cat1" which is closest to
64 "cat2"
65
66 east2,north2
67 The coordinates of the grid cell "cat2" which is closest to
68 "cat1"
69
71 The output format lends itself to filtering. For example, to "see"
72 lines connecting each of the category pairs in two maps, filter the
73 output using awk and then into d.map graph:
74
75 r.distance maps=map1,map2 | \
76 awk -F: '{print "move",$4,$5,"\ndraw",$6,$7}' | d.graph -m
77
78 To create a site list of all the "map1" coordinates, filter the output
79 into awk and then into s.in.ascii:
80
81 r.distance maps=map1,map2 | \
82 awk -F: '{print $4,$5}' | s.in.ascii sites=name
83
85 r.buffer, r.cost, r.drain, v.distance
86
88 Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
89
90 Last changed: $Date: 2006-10-04 16:32:47 +0200 (Wed, 04 Oct 2006) $
91
92 Full index
93
94 © 2003-2008 GRASS Development Team
95
96
97
98GRASS 6.3.0 r.distance(1)