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

安装GDAL/OGR后,ogrinfo等应用程序通常在命令行中使用。要运行 ogrinfo,首先定位到bin目录,如D:/assignment/gdal1.6.1_runtime/bin,然后输入命令,例如 ogrinfo 后跟各种参数选项,如 --help-general, -ro, -q 等,并指定数据源名称和文件。 ogrinfo 可以列出层信息、几何类型、特征计数等,并以OGC WKT格式报告几何。若要分屏显示大量内容,可以使用 |more 命令。" 132386516,19694632,wxWidgets事件处理详解,"['C/C++', 'GUI开发', '框架']

安装完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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值