1OGRINFO(1) GDAL OGRINFO(1)
2
3
4
6 ogrinfo - Lists information about an OGR-supported data source.
7
9 ogrinfo [--help-general] [-ro] [-q] [-where restricted_where|\@filename]
10 [-spat xmin ymin xmax ymax] [-geomfield field] [-fid fid]
11 [-sql statement|\@filename] [-dialect dialect] [-al] [-rl] [-so] [-fields={YES/NO}]
12 [-geom={YES/NO/SUMMARY/WKT/ISO_WKT}] [--formats] [[-oo NAME=VALUE] ...]
13 [-nomd] [-listmdd] [-mdd domain|`all`]*
14 [-nocount] [-noextent] [-nogeomtype] [-wkt_format WKT1|WKT2|...]
15 [-fielddomain name]
16 <datasource_name> [<layer> [<layer> ...]]
17
19 The ogrinfo program lists various information about an OGR-supported
20 data source to stdout (the terminal). By executing SQL statements it is
21 also possible to edit data.
22
23 -ro Open the data source in read-only mode.
24
25 -al List all features of all layers (used instead of having to give
26 layer names as arguments).
27
28 -rl Enable random layer reading mode, i.e. iterate over features in
29 the order they are found in the dataset, and not layer per
30 layer. This can be significantly faster for some formats (for
31 example OSM, GMLAS).
32
33 New in version 2.2.
34
35
36 -so Summary Only: suppress listing of individual features and show
37 only summary information like projection, schema, feature count
38 and extents.
39
40 -q Quiet verbose reporting of various information, including coor‐
41 dinate system, layer schema, extents, and feature count.
42
43 -where <restricted_where>
44 An attribute query in a restricted form of the queries used in
45 the SQL WHERE statement. Only features matching the attribute
46 query will be reported. Starting with GDAL 2.1, the \filename
47 syntax can be used to indicate that the content is in the
48 pointed filename.
49
50 -sql <statement>
51 Execute the indicated SQL statement and return the result.
52 Starting with GDAL 2.1, the @filename syntax can be used to in‐
53 dicate that the content is in the pointed filename. Data can
54 also be edited with SQL INSERT, UPDATE, DELETE, DROP TABLE, AL‐
55 TER TABLE etc. Editing capabilities depend on the selected di‐
56 alect.
57
58 -dialect <dialect>
59 SQL dialect. In some cases can be used to use (unoptimized)
60 ogr_sql_dialect instead of the native SQL of an RDBMS by passing
61 the OGRSQL dialect value. The sql_sqlite_dialect dialect can be
62 select with the SQLITE and INDIRECT_SQLITE dialect values, and
63 this can be used with any datasource.
64
65 -spat <xmin> <ymin> <xmax> <ymax>
66 The area of interest. Only features within the rectangle will be
67 reported.
68
69 -geomfield <field>
70 Name of the geometry field on which the spatial filter operates.
71
72 -fid <fid>
73 If provided, only the feature with this feature id will be re‐
74 ported. Operates exclusive of the spatial or attribute queries.
75 Note: if you want to select several features based on their fea‐
76 ture id, you can also use the fact the 'fid' is a special field
77 recognized by OGR SQL. So, -where "fid in (1,3,5)" would select
78 features 1, 3 and 5.
79
80 -fields YES|NO:
81 If set to NO, the feature dump will not display field values.
82 Default value is YES.
83
84 -fielddomain <domain_name>
85 New in version 3.3.
86
87
88 Display details about a field domain.
89
90 -geom YES|NO|SUMMARY|WKT|ISO_WKT
91 If set to NO, the feature dump will not display the geometry. If
92 set to SUMMARY, only a summary of the geometry will be dis‐
93 played. If set to YES or ISO_WKT, the geometry will be reported
94 in full OGC WKT format. If set to WKT the geometry will be re‐
95 ported in legacy WKT. Default value is YES. (WKT and ISO_WKT are
96 available starting with GDAL 2.1, which also changes the default
97 to ISO_WKT)
98
99 -oo NAME=VALUE
100 Dataset open option (format-specific)
101
102 -nomd Suppress metadata printing. Some datasets may contain a lot of
103 metadata strings.
104
105 -listmdd
106 List all metadata domains available for the dataset.
107
108 -mdd <domain>
109 Report metadata for the specified domain. all can be used to re‐
110 port metadata in all domains.
111
112 -nocount
113 Suppress feature count printing.
114
115 -noextent
116 Suppress spatial extent printing.
117
118 -nogeomtype
119 Suppress layer geometry type printing.
120
121 New in version 3.1.
122
123
124 --formats
125 List the format drivers that are enabled.
126
127 -wkt_format <format>
128 The WKT format used to display the SRS. Currently supported
129 values for the format are:
130
131 WKT1
132
133 WKT2 (latest WKT version, currently WKT2_2018)
134
135 WKT2_2015
136
137 WKT2_2018
138
139 New in version 3.0.0.
140
141
142 <datasource_name>
143 The data source to open. May be a filename, directory or other
144 virtual name. See the OGR Vector Formats list for supported
145 datasources.
146
147 <layer>
148 One or more layer names may be reported. If no layer names are
149 passed then ogrinfo will report a list of available layers (and
150 their layer wide geometry type). If layer name(s) are given then
151 their extents, coordinate system, feature count, geometry type,
152 schema and all features matching query parameters will be re‐
153 ported to the terminal. If no query parameters are provided, all
154 features are reported.
155
156 Geometries are reported in OGC WKT format.
157
159 Example of reporting the names of the layers in a NTF file:
160
161 ogrinfo wrk/SHETLAND_ISLANDS.NTF
162
163 # INFO: Open of `wrk/SHETLAND_ISLANDS.NTF'
164 # using driver `UK .NTF' successful.
165 # 1: BL2000_LINK (Line String)
166 # 2: BL2000_POLY (None)
167 # 3: BL2000_COLLECTIONS (None)
168 # 4: FEATURE_CLASSES (None)
169
170 Example of retrieving a summary (-so) of a layer without showing de‐
171 tails about every single feature:
172
173 ogrinfo \
174 -so \
175 natural_earth_vector.gpkg \
176 ne_10m_admin_0_antarctic_claim_limit_lines
177
178 # INFO: Open of `natural_earth_vector.gpkg'
179 # using driver `GPKG' successful.
180
181 # Layer name: ne_10m_admin_0_antarctic_claim_limit_lines
182 # Geometry: Line String
183 # Feature Count: 23
184 # Extent: (-150.000000, -90.000000) - (160.100000, -60.000000)
185 # Layer SRS WKT:
186 # GEOGCS["WGS 84",
187 # DATUM["WGS_1984",
188 # SPHEROID["WGS 84",6378137,298.257223563,
189 # AUTHORITY["EPSG","7030"]],
190 # AUTHORITY["EPSG","6326"]],
191 # PRIMEM["Greenwich",0,
192 # AUTHORITY["EPSG","8901"]],
193 # UNIT["degree",0.0174532925199433,
194 # AUTHORITY["EPSG","9122"]],
195 # AUTHORITY["EPSG","4326"]]
196 # FID Column = fid
197 # Geometry Column = geom
198 # type: String (15.0)
199 # scalerank: Integer (0.0)
200 # featurecla: String (50.0)
201
202 Example of using an attribute query to restrict the output of the fea‐
203 tures in a layer:
204
205 ogrinfo -ro \
206 -where 'GLOBAL_LINK_ID=185878' \
207 wrk/SHETLAND_ISLANDS.NTF BL2000_LINK
208
209 # INFO: Open of `wrk/SHETLAND_ISLANDS.NTF'
210 # using driver `UK .NTF' successful.
211 #
212 # Layer name: BL2000_LINK
213 # Geometry: Line String
214 # Feature Count: 1
215 # Extent: (419794.100000, 1069031.000000) - (419927.900000, 1069153.500000)
216 # Layer SRS WKT:
217 # PROJCS["OSGB 1936 / British National Grid",
218 # GEOGCS["OSGB 1936",
219 # DATUM["OSGB_1936",
220 # SPHEROID["Airy 1830",6377563.396,299.3249646]],
221 # PRIMEM["Greenwich",0],
222 # UNIT["degree",0.0174532925199433]],
223 # PROJECTION["Transverse_Mercator"],
224 # PARAMETER["latitude_of_origin",49],
225 # PARAMETER["central_meridian",-2],
226 # PARAMETER["scale_factor",0.999601272],
227 # PARAMETER["false_easting",400000],
228 # PARAMETER["false_northing",-100000],
229 # UNIT["metre",1]]
230 # LINE_ID: Integer (6.0)
231 # GEOM_ID: Integer (6.0)
232 # FEAT_CODE: String (4.0)
233 # GLOBAL_LINK_ID: Integer (10.0)
234 # TILE_REF: String (10.0)
235 # OGRFeature(BL2000_LINK):2
236 # LINE_ID (Integer) = 2
237 # GEOM_ID (Integer) = 2
238 # FEAT_CODE (String) = (null)
239 # GLOBAL_LINK_ID (Integer) = 185878
240 # TILE_REF (String) = SHETLAND I
241 # LINESTRING (419832.100 1069046.300,419820.100 1069043.800,419808.300
242 # 1069048.800,419805.100 1069046.000,419805.000 1069040.600,419809.400
243 # 1069037.400,419827.400 1069035.600,419842 1069031,419859.000
244 # 1069032.800,419879.500 1069049.500,419886.700 1069061.400,419890.100
245 # 1069070.500,419890.900 1069081.800,419896.500 1069086.800,419898.400
246 # 1069092.900,419896.700 1069094.800,419892.500 1069094.300,419878.100
247 # 1069085.600,419875.400 1069087.300,419875.100 1069091.100,419872.200
248 # 1069094.600,419890.400 1069106.400,419907.600 1069112.800,419924.600
249 # 1069133.800,419927.900 1069146.300,419927.600 1069152.400,419922.600
250 # 1069153.500,419917.100 1069153.500,419911.500 1069153.000,419908.700
251 # 1069152.500,419903.400 1069150.800,419898.800 1069149.400,419894.800
252 # 1069149.300,419890.700 1069149.400,419890.600 1069149.400,419880.800
253 # 1069149.800,419876.900 1069148.900,419873.100 1069147.500,419870.200
254 # 1069146.400,419862.100 1069143.000,419860 1069142,419854.900
255 # 1069138.600,419850 1069135,419848.800 1069134.100,419843
256 # 1069130,419836.200 1069127.600,419824.600 1069123.800,419820.200
257 # 1069126.900,419815.500 1069126.900,419808.200 1069116.500,419798.700
258 # 1069117.600,419794.100 1069115.100,419796.300 1069109.100,419801.800
259 # 1069106.800,419805.000 1069107.300)
260
261 Example of updating a value of an attribute in a shapefile with SQL by
262 using the SQLite dialect:
263
264 ogrinfo test.shp -dialect sqlite -sql "update test set attr='bar' where attr='foo'"
265
267 Frank Warmerdam <warmerdam@pobox.com>, Silke Reimer <silke@inteva‐
268 tion.de>
269
271 1998-2021
272
273
274
275
276 Sep 07, 2021 OGRINFO(1)