1GDALLOCATIONINFO(1) GDAL GDALLOCATIONINFO(1)
2
3
4
6 gdallocationinfo - Raster query tool.
7
9 Usage: gdallocationinfo [--help-general] [-xml] [-lifonly] [-valonly]
10 [-b band]* [-overview overview_level]
11 [-l_srs srs_def] [-geoloc] [-wgs84]
12 [-oo NAME=VALUE]* srcfile [x y]
13
15 The gdallocationinfo utility provide a mechanism to query information
16 about a pixel given its location in one of a variety of coordinate sys‐
17 tems. Several reporting options are provided.
18
19 -xml The output report will be XML formatted for convenient post pro‐
20 cessing.
21
22 -lifonly
23 The only output is filenames production from the LocationInfo
24 request against the database (i.e. for identifying impacted file
25 from VRT).
26
27 -valonly
28 The only output is the pixel values of the selected pixel on
29 each of the selected bands.
30
31 -b <band>
32 Selects a band to query. Multiple bands can be listed. By
33 default all bands are queried.
34
35 -overview <overview_level>
36 Query the (overview_level)th overview (overview_level=1 is the
37 1st overview), instead of the base band. Note that the x,y loca‐
38 tion (if the coordinate system is pixel/line) must still be
39 given with respect to the base band.
40
41 -l_srs <srs_def>
42 The coordinate system of the input x, y location.
43
44 -geoloc
45 Indicates input x,y points are in the georeferencing system of
46 the image.
47
48 -wgs84 Indicates input x,y points are WGS84 long, lat.
49
50 -oo NAME=VALUE
51 Dataset open option (format specific)
52
53 <srcfile>
54 The source GDAL raster datasource name.
55
56 <x> X location of target pixel. By default the coordinate system is
57 pixel/line unless -l_srs, -wgs84 or -geoloc supplied.
58
59 <y> Y location of target pixel. By default the coordinate system is
60 pixel/line unless -l_srs, -wgs84 or -geoloc supplied.
61
62 This utility is intended to provide a variety of information about a
63 pixel. Currently it reports:
64
65 · The location of the pixel in pixel/line space.
66
67 · The result of a LocationInfo metadata query against the datasource.
68 This is implement for VRT files which will report the file(s) used to
69 satisfy requests for that pixel, and by the raster.mbtiles driver
70
71 · The raster pixel value of that pixel for all or a subset of the
72 bands.
73
74 · The unscaled pixel value if a Scale and/or Offset apply to the band.
75
76 The pixel selected is requested by x/y coordinate on the command line,
77 or read from stdin. More than one coordinate pair can be supplied when
78 reading coordinates from stdin. By default pixel/line coordinates are
79 expected. However with use of the -geoloc, -wgs84, or -l_srs switches
80 it is possible to specify the location in other coordinate systems.
81
82 The default report is in a human readable text format. It is possible
83 to instead request xml output with the -xml switch.
84
85 For scripting purposes, the -valonly and -lifonly switches are provided
86 to restrict output to the actual pixel values, or the LocationInfo
87 files identified for the pixel.
88
89 It is anticipated that additional reporting capabilities will be added
90 to gdallocationinfo in the future.
91
93 Simple example reporting on pixel (256,256) on the file utm.tif.
94
95 $ gdallocationinfo utm.tif 256 256
96 Report:
97 Location: (256P,256L)
98 Band 1:
99 Value: 115
100
101 Query a VRT file providing the location in WGS84, and getting the
102 result in xml.
103
104 $ gdallocationinfo -xml -wgs84 utm.vrt -117.5 33.75
105 <Report pixel="217" line="282">
106 <BandReport band="1">
107 <LocationInfo>
108 <File>utm.tif</File>
109 </LocationInfo>
110 <Value>16</Value>
111 </BandReport>
112 </Report>
113
114 Reading location from stdin.
115
116 $ cat coordinates.txt
117 443020 3748359
118 441197 3749005
119 443852 3747743
120
121 $ cat coordinates.txt | gdallocationinfo -geoloc utmsmall.tif
122 Report:
123 Location: (38P,49L)
124 Band 1:
125 Value: 214
126 Report:
127 Location: (7P,38L)
128 Band 1:
129 Value: 107
130 Report:
131 Location: (52P,59L)
132 Band 1:
133 Value: 148
134
136 Frank Warmerdam <warmerdam@pobox.com>
137
139 1998-2021
140
141
142
143
144 Jan 05, 2021 GDALLOCATIONINFO(1)