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]
16
17 Flags:
18 -l Include category labels in the output
19
20 -o Report zero distance if rasters are overlapping
21
22 -q Run quietly
23
24 Parameters:
25 maps=map1,map2
26 Maps for computing inter-class distances
27
28 fs=string
29 Output field separator Default: :
30
32 Locates the closest points between "objects" in two raster maps. An
33 "object" is defined as all the grid cells that have the same category
34 number, and closest means having the shortest "straight-line" distance.
35 The cell centers are considered for the distance calculation (two adja‐
36 cent grid cells have the distance between their cell centers).
37
38 The output is an ascii list, one line per pair of objects
39 cat1:cat2:distance:east1:north1:east2:north2
40
41
42 Explanation:
43 cat1 Category number from map1
44
45 cat2 Category number from map2
46
47 distance
48 The distance in meters between "cat1" and "cat2"
49
50 east1,north1
51 The coordinates of the grid cell "cat1" which is closest to
52 "cat2"
53
54 east2,north2
55 The coordinates of the grid cell "cat2" which is closest to
56 "cat1"
57
59 The output format lends itself to filtering. For example, to "see"
60 lines connecting each of the category pairs in two maps, filter the
61 output using awk and then into d.map graph:
62
63 r.distance maps=map1,map2 | \
64 awk -F: '{print "move",$4,$5,"\ndraw",$6,$7}' | d.graph -m
65
66 To create a site list of all the "map1" coordinates, filter the output
67 into awk and then into s.in.ascii:
68
69 r.distance maps=map1,map2 | \
70 awk -F: '{print $4,$5}' | s.in.ascii sites=name
71
73 r.buffer, r.cost, r.drain, v.distance
74
76 Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
77
78 Last changed: $Date: 2007/05/28 13:08:50 $
79
80 Full index
81
82
83
84GRASS 6.2.2 r.distance(1)