使用OGR自带应用程序如ogrinfo等

安装完GDAL/OGR后,在bin目录中,ogr自带的application如ogrinfo.exe等程序直接双击打开时一闪而过的,这些东东一般都是从命令行中打开。

首先进入该exe文件的目录中,如D:/assignment/gdal1.6.1_runtime/bin;

然后输入该程序名,如ogrinfo,后面跟

ogrinfo [–help-general] [-ro] [-q] [-where restricted_where]
        [-spat xmin ymin xmax ymax] [-fid fid]
        [-sql statement] [-al] [-so] [-fields={YES/NO}]
        [-geom={YES/NO/SUMMARY}][–formats]
        datasource_name [layer [layer …]]
中带括号部分的限制条件,最后加上要打开的文件名(完整的文件名,包括后缀名)。

上面各部分限制条件的含义如下:

-ro:

         Open the data source in read-only mode.

-al:
List all features of all layers (used instead of having to give layer names as arguments).
-so:
Summary Only: supress listing of features, show only the summary information like projection, schema, feature count and extents.
-q:
Quiet verbose reporting of various information, including coordinate system, layer schema, extents, and feature count.
-where restricted_where:
An attribute query in a restricted form of the queries used in the SQL WHERE statement. Only features matching the attribute query will be reported.
-sql statement:
Execute the indicated SQL statement and return the result.
-spat xmin ymin xmax ymax:
The area of interest. Only features within the rectangle will be reported.
-fid fid:
If provided, only the feature with this feature id will be reported. Operates exclusive of the spatial or attribute queries. Note: if you want to select several features based on their feature id, you can also use the fact the ‘fid’ is a special field recognized by OGR SQL. So, ‘-where “fid in (1,3,5)”‘ would select features 1, 3 and 5.
-fields={YES/NO}:
(starting with GDAL 1.6.0) If set to NO, the feature dump will not display field values. Default value is YES.
-geom={YES/NO/SUMMARY}:
(starting with GDAL 1.6.0) If set to NO, the feature dump will not display the geometry. If set to SUMMARY, only a summary of the geometry will be displayed. If set to YES, the geometry will be reported in full OGC WKT format. Default value is YES.
–formats:
List the format drivers that are enabled.
datasource_name:
The data source to open. May be a filename, directory or other virtual name. See the OGR Vector Formats list for supported datasources.
layer:
One or more layer names may be reported.

If no layer names are passed then ogrinfo will report a list of available layers (and their layerwide geometry type). If layer name(s) are given then their extents, coordinate system, feature count, geometry type, schema and all features matching query parameters will be reported to the terminal. If no query parameters are provided, all features are reported.

Geometries are reported in OGC WKT format.

 

例如:希望读取所有信息但不包括一些杂项如坐标系、特征项总数等,则输入显示如下(这里默认000格式文件就位于ogrinfo软件的同一个根目录下,如果不是可以直接在文件名US1AK90M.000前面加上路径,即形成完整的路径名即可):

D:/assignment/gdal1.6.1_runtime/bin>ogrinfo -ro -al -q US1AK90M.000

 

注意:由于显示内容太多,需要分屏显示,此时后面加上”|more”就可以了(这里加上/p是不行的)。如:

D:/assignment/gdal1.6.1_runtime/bin>ogrinfo -ro -al -q US1AK90M.000 |more

转载自:https://blog.csdn.net/Randyqiu/article/details/4641142

You may also like...