The ogrinfo
utility
The official documentation for the
ogrinfo
utility is http://www.gdal.org/ogr/ogrinfo.html
-so Summary Only
supress listing of features, show only the summary information like projection, schema, feature count and extents.
To get this info with shapefiles you must also provide the layer
name, else not much useful is returned:
$ ogrinfo -so contours.shp INFO: Open of `contours.shp' using driver `ESRI Shapefile' successful. 1: contours (Line String)
Likely what is really wanted is:
$ ogrinfo -so contours.shp contours INFO: Open of `contours.shp' using driver `ESRI Shapefile' successful. Layer name: contours Geometry: Line String Feature Count: 3393 Extent: (57537.995662, 663561.802226) - (88297.082026, 694443.881449) Layer SRS WKT: PROJCS["Albers", ...etc.
Alternatively, use the -al
switch to see information on all layers.
Adding a column through SQL
Using ogrinfo is it possible to use SQL language to add a column to an input file.
The SQL syntax is a standard ALTER TABLE
statement; it's necessary to add -sql
switch. In example
$ ogrinfo input.shp -sql "ALTER TABLE input ADD fieldX float" INFO: Open of `input.shp' using driver `ESRI Shapefile' successful.
In this zip file there are two files to test this command: an input file ("input.shp") and "input_AfterOgrinfo.shp", that is what "input.shp" becomes after ogrinfo command.
Attachments (1)
-
ogrinfo_sql.zip
(43.5 KB
) - added by 8 years ago.
A file to test ogrinfo sql command
Download all attachments as: .zip