1r.profile(1) GRASS GIS User's Manual r.profile(1)
2
3
4
6 r.profile - Outputs the raster map layer values lying on user-defined
7 line(s).
8
10 raster, profile, transect
11
13 r.profile
14 r.profile --help
15 r.profile [-gc] input=name [output=name] [coordi‐
16 nates=east,north[,east,north,...]] [file=name] [resolution=float]
17 [null_value=string] [units=string] [--overwrite] [--help] [--ver‐
18 bose] [--quiet] [--ui]
19
20 Flags:
21 -g
22 Output easting and northing in first two columns of four column
23 output
24
25 -c
26 Output RRR:GGG:BBB color values for each profile point
27
28 --overwrite
29 Allow output files to overwrite existing files
30
31 --help
32 Print usage summary
33
34 --verbose
35 Verbose module output
36
37 --quiet
38 Quiet module output
39
40 --ui
41 Force launching GUI dialog
42
43 Parameters:
44 input=name [required]
45 Name of input raster map
46
47 output=name
48 Name of file for output (use output=- for stdout)
49 Default: -
50
51 coordinates=east,north[,east,north,...]
52 Profile coordinate pairs
53
54 file=name
55 Name of input file containing coordinate pairs
56 Use instead of the ’coordinates’ option. "-" reads from stdin.
57
58 resolution=float
59 Resolution along profile (default = current region resolution)
60
61 null_value=string
62 String representing NULL value
63 Default: *
64
65 units=string
66 Units
67 If units are not specified, current location units are used. Meters
68 are used by default in geographic (latlon) locations.
69 Options: meters, kilometers, feet, miles
70
72 This program outputs two or four column (with -g) data to stdout or an
73 ASCII file. The default two column output consists of cumulative pro‐
74 file length and raster value. The optional four column output consists
75 of easting, northing, cumulative profile length, and raster value. Pro‐
76 file end or "turning" points can be set manually with the coordinates
77 argument. The profile resolution, or distance between profile points,
78 is obtained from the current region resolution, or can be manually set
79 with the resolution argument.
80
81 The coordinates parameter can be set to comma separated geographic co‐
82 ordinates for profile line endpoints. Alternatively the coordinate
83 pairs can be piped from the text file specified by file option, or if
84 set to "-", from stdin. In these cases the coordinate pairs should be
85 given one comma separated pair per line.
86
87 The resolution parameter sets the distance between each profile point
88 (resolution). The resolution must be provided in GRASS database units
89 (i.e. decimal degrees for Lat Long databases and meters for UTM). By
90 default r.profile uses the resolution of the current GRASS region.
91
92 The null parameter can optionally be set to change the character string
93 representing null values.
94
96 The multi column output from r.profile is intended for easy use in
97 other programs. The output can be piped (|) directly into other pro‐
98 grams or saved to a file for later use. Output with geographic coordi‐
99 nates (-g) is compatible with v.in.ascii and can be piped directly into
100 this program.
101 r.profile -g input=elevation coordinates=... | v.in.ascii output=elevation_profile separator=space
102 The 2 column output is compatible with most plotting programs.
103
104 The optional RGB output provides the associated GRASS colour value for
105 each profile point.
106
107 Option units enables to set units of the profile length output. If the
108 units are not specified, current location units will be used. In case
109 of geographic locations (latitude/longitude), meters are used as de‐
110 fault unit.
111
113 The profile resolution is measured exactly from the supplied end or
114 "turning" point along the profile. The end of a profile segment will be
115 an exact multiple of the profile resolution and will therefore not al‐
116 ways match the end point coordinates entered for the segmanet.
117
118 To extract the numbers in scripts, following parameters can be used:
119 r.profile input=dgm12.5 coordinates=3570631,5763556 2>/dev/null
120 This filters out everything except the numbers.
121
123 Extraction of values along profile defined by coordinates (variant 1)
124 Extract a profile with coordinates (wayoints) provided on the command
125 line (North Carolina data set):
126 g.region raster=elevation -p
127 r.profile -g input=elevation output=profile_points.csv \
128 coordinates=641712,226095,641546,224138,641546,222048,641049,221186
129 This will extract a profile along the track defined by the three coor‐
130 dinate pairs. The output file "profile_points.csv" contains
131 east,north,distance,value (here: elevation).
132
133 Extraction of values along profile defined by coordinates (variant 2)
134 Coordinate pairs can also be "piped" into r.profile (variant 2a):
135 r.profile elevation resolution=1000 file=- << EOF
136 641712,226095
137 641546,224138
138 641546,222048
139 641049,221186
140 EOF
141
142 Coordinate pairs can also be "piped" into r.profile (variant 2b):
143 echo "641712,226095
144 641546,224138
145 641546,222048
146 641049,221186" > coors.txt
147 cat coors.txt | r.profile elevation resolution=1000 file=-
148 The output is printed into the terminal (unless the output parameter is
149 used) and looks as follows:
150 Using resolution: 1000 [meters]
151 Output columns:
152 Along track dist. [meters], Elevation
153 Approx. transect length: 1964.027749 [meters]
154 0.000000 84.661507
155 1000.000000 98.179062
156 Approx. transect length: 2090.000000 [meters]
157 1964.027749 83.638138
158 2964.027749 89.141029
159 3964.027749 78.497757
160 Approx. transect length: 995.014070 [meters]
161 4054.027749 73.988029
162
164 v.in.ascii, r.what, r.transect, wxGUI profile tool
165
167 Bob Covill
168
170 Available at: r.profile source code (history)
171
172 Accessed: Saturday Oct 28 18:17:50 2023
173
174 Main index | Raster index | Topics index | Keywords index | Graphical
175 index | Full index
176
177 © 2003-2023 GRASS Development Team, GRASS GIS 8.3.1 Reference Manual
178
179
180
181GRASS 8.3.1 r.profile(1)