1OGRINFO(1) GDAL OGRINFO(1)
2
3
4
6 ogrinfo - Lists information about an OGR-supported data source.
7
9 ogrinfo [--help-general] [-json] [-ro] [-q] [-where restricted_where|@filename]
10 [-spat xmin ymin xmax ymax] [-geomfield field] [-fid fid]
11 [-sql statement|@filename] [-dialect dialect] [-al] [-rl]
12 [-so|-features] [-fields={YES/NO}]
13 [-geom={YES/NO/SUMMARY/WKT/ISO_WKT}] [--formats] [[-oo NAME=VALUE] ...]
14 [-nomd] [-listmdd] [-mdd domain|`all`]*
15 [-nocount] [-noextent] [-nogeomtype] [-wkt_format WKT1|WKT2|...]
16 [-fielddomain name]
17 <datasource_name> [<layer> [<layer> ...]]
18
20 The ogrinfo program lists various information about an OGR-supported
21 data source to stdout (the terminal). By executing SQL statements it is
22 also possible to edit data.
23
24 -json Display the output in json format, conforming to the
25 ogrinfo.schema.json schema.
26
27 New in version 3.7.
28
29
30 -ro Open the data source in read-only mode.
31
32 -al List all layers (used instead of having to give layer names as
33 arguments). In the default text output, this also enables list‐
34 ing all features, which can be disabled with -so. In JSON out‐
35 put, -al is implicit, but listing of features must be explicitly
36 enabled with -features.
37
38 -rl Enable random layer reading mode, i.e. iterate over features in
39 the order they are found in the dataset, and not layer per
40 layer. This can be significantly faster for some formats (for
41 example OSM, GMLAS).
42
43 New in version 2.2.
44
45
46 -so Summary Only: suppress listing of individual features and show
47 only summary information like projection, schema, feature count
48 and extents.
49
50 -features
51 Enable listing of features. This has the opposite effect of -so.
52
53 This option should be used with caution if using the library
54 function GDALVectorInfo() and/or -json, as the whole output of
55 ogrinfo will be built in memory. Consequently, when used on a
56 large collection of features, RAM may be exhausted.
57
58 New in version 3.7.
59
60
61 -q Quiet verbose reporting of various information, including coor‐
62 dinate system, layer schema, extents, and feature count.
63
64 -where <restricted_where>
65 An attribute query in a restricted form of the queries used in
66 the SQL WHERE statement. Only features matching the attribute
67 query will be reported. Starting with GDAL 2.1, the \filename
68 syntax can be used to indicate that the content is in the
69 pointed filename.
70
71 -sql <statement>
72 Execute the indicated SQL statement and return the result.
73 Starting with GDAL 2.1, the @filename syntax can be used to in‐
74 dicate that the content is in the pointed filename. Data can
75 also be edited with SQL INSERT, UPDATE, DELETE, DROP TABLE, AL‐
76 TER TABLE etc. Editing capabilities depend on the selected di‐
77 alect.
78
79 -dialect <dialect>
80 SQL dialect. In some cases can be used to use (unoptimized) OGR
81 SQL dialect instead of the native SQL of an RDBMS by passing the
82 OGRSQL dialect value. The SQL SQLite dialect can be selected
83 with the SQLITE and INDIRECT_SQLITE dialect values, and this can
84 be used with any datasource.
85
86 -spat <xmin> <ymin> <xmax> <ymax>
87 The area of interest. Only features within the rectangle will be
88 reported.
89
90 -geomfield <field>
91 Name of the geometry field on which the spatial filter operates.
92
93 -fid <fid>
94 If provided, only the feature with this feature id will be re‐
95 ported. Operates exclusive of the spatial or attribute queries.
96 Note: if you want to select several features based on their fea‐
97 ture id, you can also use the fact the 'fid' is a special field
98 recognized by OGR SQL. So, -where "fid in (1,3,5)" would select
99 features 1, 3 and 5.
100
101 -fields YES|NO:
102 If set to NO, the feature dump will not display field values.
103 Default value is YES.
104
105 -fielddomain <domain_name>
106 New in version 3.3.
107
108
109 Display details about a field domain.
110
111 -geom YES|NO|SUMMARY|WKT|ISO_WKT
112 If set to NO, the feature dump will not display the geometry. If
113 set to SUMMARY, only a summary of the geometry will be dis‐
114 played. If set to YES or ISO_WKT, the geometry will be reported
115 in full OGC WKT format. If set to WKT the geometry will be re‐
116 ported in legacy WKT. Default value is YES. (WKT and ISO_WKT are
117 available starting with GDAL 2.1, which also changes the default
118 to ISO_WKT)
119
120 -oo NAME=VALUE
121 Dataset open option (format-specific)
122
123 -nomd Suppress metadata printing. Some datasets may contain a lot of
124 metadata strings.
125
126 -listmdd
127 List all metadata domains available for the dataset.
128
129 -mdd <domain>
130 Report metadata for the specified domain. all can be used to re‐
131 port metadata in all domains.
132
133 -nocount
134 Suppress feature count printing.
135
136 -noextent
137 Suppress spatial extent printing.
138
139 -nogeomtype
140 Suppress layer geometry type printing.
141
142 New in version 3.1.
143
144
145 --formats
146 List the format drivers that are enabled.
147
148 -wkt_format <format>
149 The WKT format used to display the SRS. Currently supported
150 values for the format are:
151
152 WKT1
153
154 WKT2 (latest WKT version, currently WKT2_2018)
155
156 WKT2_2015
157
158 WKT2_2018
159
160 New in version 3.0.0.
161
162
163 <datasource_name>
164 The data source to open. May be a filename, directory or other
165 virtual name. See the OGR Vector Formats list for supported
166 datasources.
167
168 <layer>
169 One or more layer names may be reported. If no layer names are
170 passed then ogrinfo will report a list of available layers (and
171 their layer wide geometry type). If layer name(s) are given then
172 their extents, coordinate system, feature count, geometry type,
173 schema and all features matching query parameters will be re‐
174 ported to the terminal. If no query parameters are provided, all
175 features are reported.
176
177 Geometries are reported in OGC WKT format.
178
180 This utility is also callable from C with GDALVectorInfo().
181
182 New in version 3.7.
183
184
186 Example of reporting the names of the layers in a NTF file:
187
188 ogrinfo wrk/SHETLAND_ISLANDS.NTF
189
190 # INFO: Open of `wrk/SHETLAND_ISLANDS.NTF'
191 # using driver `UK .NTF' successful.
192 # 1: BL2000_LINK (Line String)
193 # 2: BL2000_POLY (None)
194 # 3: BL2000_COLLECTIONS (None)
195 # 4: FEATURE_CLASSES (None)
196
197 Example of retrieving a summary (-so) of a layer without showing de‐
198 tails about every single feature:
199
200 ogrinfo \
201 -so \
202 natural_earth_vector.gpkg \
203 ne_10m_admin_0_antarctic_claim_limit_lines
204
205 # INFO: Open of `natural_earth_vector.gpkg'
206 # using driver `GPKG' successful.
207
208 # Layer name: ne_10m_admin_0_antarctic_claim_limit_lines
209 # Geometry: Line String
210 # Feature Count: 23
211 # Extent: (-150.000000, -90.000000) - (160.100000, -60.000000)
212 # Layer SRS WKT:
213 # GEOGCS["WGS 84",
214 # DATUM["WGS_1984",
215 # SPHEROID["WGS 84",6378137,298.257223563,
216 # AUTHORITY["EPSG","7030"]],
217 # AUTHORITY["EPSG","6326"]],
218 # PRIMEM["Greenwich",0,
219 # AUTHORITY["EPSG","8901"]],
220 # UNIT["degree",0.0174532925199433,
221 # AUTHORITY["EPSG","9122"]],
222 # AUTHORITY["EPSG","4326"]]
223 # FID Column = fid
224 # Geometry Column = geom
225 # type: String (15.0)
226 # scalerank: Integer (0.0)
227 # featurecla: String (50.0)
228
229 Example of retrieving information on a file in JSON format without
230 showing details about every single feature:
231
232 ogrinfo -json poly.shp
233
234 {
235 "description":"autotest/ogr/data/poly.shp",
236 "driverShortName":"ESRI Shapefile",
237 "driverLongName":"ESRI Shapefile",
238 "layers":[
239 {
240 "name":"poly",
241 "metadata":{
242 "":{
243 "DBF_DATE_LAST_UPDATE":"2018-08-02"
244 },
245 "SHAPEFILE":{
246 "SOURCE_ENCODING":""
247 }
248 },
249 "geometryFields":[
250 {
251 "name":"",
252 "type":"Polygon",
253 "nullable":true,
254 "extent":[
255 478315.53125,
256 4762880.5,
257 481645.3125,
258 4765610.5
259 ],
260 "coordinateSystem":{
261 "wkt":"PROJCRS[\"OSGB36 / British National Grid\",BASEGEOGCRS[\"OSGB36\",DATUM[\"Ordnance Survey of Great Britain 1936\",ELLIPSOID[\"Airy 1830\",6377563.396,299.3249646,LENGTHUNIT[\"metre\",1]]],PRIMEM[\"Greenwich\",0,ANGLEUNIT[\"degree\",0.0174532925199433]],ID[\"EPSG\",4277]],CONVERSION[\"British National Grid\",METHOD[\"Transverse Mercator\",ID[\"EPSG\",9807]],PARAMETER[\"Latitude of natural origin\",49,ANGLEUNIT[\"degree\",0.0174532925199433],ID[\"EPSG\",8801]],PARAMETER[\"Longitude of natural origin\",-2,ANGLEUNIT[\"degree\",0.0174532925199433],ID[\"EPSG\",8802]],PARAMETER[\"Scale factor at natural origin\",0.9996012717,SCALEUNIT[\"unity\",1],ID[\"EPSG\",8805]],PARAMETER[\"False easting\",400000,LENGTHUNIT[\"metre\",1],ID[\"EPSG\",8806]],PARAMETER[\"False northing\",-100000,LENGTHUNIT[\"metre\",1],ID[\"EPSG\",8807]]],CS[Cartesian,2],AXIS[\"(E)\",east,ORDER[1],LENGTHUNIT[\"metre\",1]],AXIS[\"(N)\",north,ORDER[2],LENGTHUNIT[\"metre\",1]],USAGE[SCOPE[\"Engineering survey, topographic mapping.\"],AREA[\"United Kingdom (UK) - offshore to boundary of UKCS within 49°45'N to 61°N and 9°W to 2°E; onshore Great Britain (England, Wales and Scotland). Isle of Man onshore.\"],BBOX[49.75,-9,61.01,2.01]],ID[\"EPSG\",27700]]",
262 "projjson":{
263 "$schema":"https://proj.org/schemas/v0.6/projjson.schema.json",
264 "type":"ProjectedCRS",
265 "name":"OSGB36 / British National Grid",
266 "base_crs":{
267 "name":"OSGB36",
268 "datum":{
269 "type":"GeodeticReferenceFrame",
270 "name":"Ordnance Survey of Great Britain 1936",
271 "ellipsoid":{
272 "name":"Airy 1830",
273 "semi_major_axis":6377563.396,
274 "inverse_flattening":299.3249646
275 }
276 },
277 "coordinate_system":{
278 "subtype":"ellipsoidal",
279 "axis":[
280 {
281 "name":"Geodetic latitude",
282 "abbreviation":"Lat",
283 "direction":"north",
284 "unit":"degree"
285 },
286 {
287 "name":"Geodetic longitude",
288 "abbreviation":"Lon",
289 "direction":"east",
290 "unit":"degree"
291 }
292 ]
293 },
294 "id":{
295 "authority":"EPSG",
296 "code":4277
297 }
298 },
299 "conversion":{
300 "name":"British National Grid",
301 "method":{
302 "name":"Transverse Mercator",
303 "id":{
304 "authority":"EPSG",
305 "code":9807
306 }
307 },
308 "parameters":[
309 {
310 "name":"Latitude of natural origin",
311 "value":49,
312 "unit":"degree",
313 "id":{
314 "authority":"EPSG",
315 "code":8801
316 }
317 },
318 {
319 "name":"Longitude of natural origin",
320 "value":-2,
321 "unit":"degree",
322 "id":{
323 "authority":"EPSG",
324 "code":8802
325 }
326 },
327 {
328 "name":"Scale factor at natural origin",
329 "value":0.9996012717,
330 "unit":"unity",
331 "id":{
332 "authority":"EPSG",
333 "code":8805
334 }
335 },
336 {
337 "name":"False easting",
338 "value":400000,
339 "unit":"metre",
340 "id":{
341 "authority":"EPSG",
342 "code":8806
343 }
344 },
345 {
346 "name":"False northing",
347 "value":-100000,
348 "unit":"metre",
349 "id":{
350 "authority":"EPSG",
351 "code":8807
352 }
353 }
354 ]
355 },
356 "coordinate_system":{
357 "subtype":"Cartesian",
358 "axis":[
359 {
360 "name":"Easting",
361 "abbreviation":"E",
362 "direction":"east",
363 "unit":"metre"
364 },
365 {
366 "name":"Northing",
367 "abbreviation":"N",
368 "direction":"north",
369 "unit":"metre"
370 }
371 ]
372 },
373 "scope":"Engineering survey, topographic mapping.",
374 "area":"United Kingdom (UK) - offshore to boundary of UKCS within 49°45'N to 61°N and 9°W to 2°E; onshore Great Britain (England, Wales and Scotland). Isle of Man onshore.",
375 "bbox":{
376 "south_latitude":49.75,
377 "west_longitude":-9,
378 "north_latitude":61.01,
379 "east_longitude":2.01
380 },
381 "id":{
382 "authority":"EPSG",
383 "code":27700
384 }
385 },
386 "dataAxisToSRSAxisMapping":[
387 1,
388 2
389 ]
390 }
391 }
392 ],
393 "featureCount":10,
394 "fields":[
395 {
396 "name":"AREA",
397 "type":"Real",
398 "width":12,
399 "precision":3,
400 "nullable":true,
401 "uniqueConstraint":false
402 },
403 {
404 "name":"EAS_ID",
405 "type":"Integer64",
406 "width":11,
407 "nullable":true,
408 "uniqueConstraint":false
409 },
410 {
411 "name":"PRFEDEA",
412 "type":"String",
413 "width":16,
414 "nullable":true,
415 "uniqueConstraint":false
416 }
417 ]
418 }
419 ],
420 "metadata":{
421 },
422 "domains":{
423 },
424 "relationships":{
425 }
426 }
427
428 Example of using an attribute query to restrict the output of the fea‐
429 tures in a layer:
430
431 ogrinfo -ro \
432 -where 'GLOBAL_LINK_ID=185878' \
433 wrk/SHETLAND_ISLANDS.NTF BL2000_LINK
434
435 # INFO: Open of `wrk/SHETLAND_ISLANDS.NTF'
436 # using driver `UK .NTF' successful.
437 #
438 # Layer name: BL2000_LINK
439 # Geometry: Line String
440 # Feature Count: 1
441 # Extent: (419794.100000, 1069031.000000) - (419927.900000, 1069153.500000)
442 # Layer SRS WKT:
443 # PROJCS["OSGB 1936 / British National Grid",
444 # GEOGCS["OSGB 1936",
445 # DATUM["OSGB_1936",
446 # SPHEROID["Airy 1830",6377563.396,299.3249646]],
447 # PRIMEM["Greenwich",0],
448 # UNIT["degree",0.0174532925199433]],
449 # PROJECTION["Transverse_Mercator"],
450 # PARAMETER["latitude_of_origin",49],
451 # PARAMETER["central_meridian",-2],
452 # PARAMETER["scale_factor",0.999601272],
453 # PARAMETER["false_easting",400000],
454 # PARAMETER["false_northing",-100000],
455 # UNIT["metre",1]]
456 # LINE_ID: Integer (6.0)
457 # GEOM_ID: Integer (6.0)
458 # FEAT_CODE: String (4.0)
459 # GLOBAL_LINK_ID: Integer (10.0)
460 # TILE_REF: String (10.0)
461 # OGRFeature(BL2000_LINK):2
462 # LINE_ID (Integer) = 2
463 # GEOM_ID (Integer) = 2
464 # FEAT_CODE (String) = (null)
465 # GLOBAL_LINK_ID (Integer) = 185878
466 # TILE_REF (String) = SHETLAND I
467 # LINESTRING (419832.100 1069046.300,419820.100 1069043.800,419808.300
468 # 1069048.800,419805.100 1069046.000,419805.000 1069040.600,419809.400
469 # 1069037.400,419827.400 1069035.600,419842 1069031,419859.000
470 # 1069032.800,419879.500 1069049.500,419886.700 1069061.400,419890.100
471 # 1069070.500,419890.900 1069081.800,419896.500 1069086.800,419898.400
472 # 1069092.900,419896.700 1069094.800,419892.500 1069094.300,419878.100
473 # 1069085.600,419875.400 1069087.300,419875.100 1069091.100,419872.200
474 # 1069094.600,419890.400 1069106.400,419907.600 1069112.800,419924.600
475 # 1069133.800,419927.900 1069146.300,419927.600 1069152.400,419922.600
476 # 1069153.500,419917.100 1069153.500,419911.500 1069153.000,419908.700
477 # 1069152.500,419903.400 1069150.800,419898.800 1069149.400,419894.800
478 # 1069149.300,419890.700 1069149.400,419890.600 1069149.400,419880.800
479 # 1069149.800,419876.900 1069148.900,419873.100 1069147.500,419870.200
480 # 1069146.400,419862.100 1069143.000,419860 1069142,419854.900
481 # 1069138.600,419850 1069135,419848.800 1069134.100,419843
482 # 1069130,419836.200 1069127.600,419824.600 1069123.800,419820.200
483 # 1069126.900,419815.500 1069126.900,419808.200 1069116.500,419798.700
484 # 1069117.600,419794.100 1069115.100,419796.300 1069109.100,419801.800
485 # 1069106.800,419805.000 1069107.300)
486
487 Example of updating a value of an attribute in a shapefile with SQL by
488 using the SQLite dialect:
489
490 ogrinfo test.shp -dialect sqlite -sql "update test set attr='bar' where attr='foo'"
491
493 Frank Warmerdam <warmerdam@pobox.com>, Silke Reimer <silke@inteva‐
494 tion.de>
495
497 1998-2023
498
499
500
501
502 Oct 30, 2023 OGRINFO(1)