• 周五. 4月 26th, 2024

5G编程聚合网

5G时代下一个聚合的编程学习网

热门标签

ogrinfo使用

admin

11月 28, 2021

简介

  1. orginfo是OGR模块中提供的一个重要工具,用于读取地图文件中记录,可以指定筛选条件(按字段、sql、矩形范围)

使用方式

  •   命令行参数
  • Usage: ogrinfo [--help-general] [-ro] [-q] [-where restricted_where]
                   [-spat xmin ymin xmax ymax] [-geomfield field] [-fid fid]
                   [-sql statement] [-dialect sql_dialect] [-al] [-so] [-fields={YES/NO}]
                   [-geom={YES/NO/SUMMARY}] [-formats] [[-oo NAME=VALUE] ...]
                   [-nomd] [-listmdd] [-mdd domain|`all`]*
                   [-nocount] [-noextent]
                   datasource_name [layer [layer ...]]
  • -ro 以只读方式打开数据源
  • -al 显示所有层的features。
  • -so 不同显示feature,只显示摘要,如字段定义,投影信息,feature总数等。
  • -q 不要显示一些冗余信息,如投影信息,feature总数等。
  • -where 接一个SQL的WHERE子句,用于记录过滤。
  • -sql 接一个完整的SQL表达,可以进行聚合,分组,排序等。
  • -dialect 接SQL dialect。
  • -spat 后面接xmin ymin xmax ymax,指定一个筛选范围。
  • -fid 选择指定id的feature,如果要输出多个fid,建议用-where “fid in (1,3,5)”
  • -fields 可以接YES或NO,如果为NO,则不显示字段的value,缺省是YES。
  • -geom 可以接YES或NO,如果为NO,则不显示feature的形状坐标信息,缺省是YES。
  • –formats 查看支持的数据源类型。
  • datasource_name 数据源,可以为文件名,目录或者虚拟名称,由支持的数据格式而定。
  • layer 可以指定多个层,对于shp文件类型的datasource而言,layer只有一个,与文件名同名(不含扩展名)。

例子

  • 显示一个shp文件所有记录:
  • ogrinfo -ro -al Railway.shp
    
    OGRFeature(Railway):77
      MESH (String) = J50F001020
      RAIL_ID (Integer64) = 78
      NAME_CHN (String) = µØÌúÊ®ºÅÏß
      NAME_TRD (String) = µØèFʮ̖¾Q
      NAME_PY (String) = DiTie ShiHao Xian
      NAME_ENG (String) = Subway Line 10
      DISP_CLASS (Integer) = 3
      RAIL_TYPE (Integer) = 5200
      RAIL_LEVEL (Integer) = 3
      STATUS (Integer) = 1
      AD_CODE (String) = (null)
      AREA_FLAG (Integer) = 0
      CREATETIME (String) = (null)
      UPDATETIME (String) = (null)
      LINESTRING (419261.907226560171694 143723.990234370343387,419262.256835940293968 143704.832031250232831,419262.260910180164501 143704.608921290142462)
  • 显示一个shp文件中RAIL_ID字段等于243的所有记录:
  • [xingxing.dxx@30_28_6_20 J50F001020]$ ogrinfo -ro -al -where 'RAIL_ID=77' Railway.shp
    INFO: Open of `Railway.shp'
          using driver `ESRI Shapefile' successful.
    
    Layer name: Railway
    Geometry: Line String
    Feature Count: 1
    Extent: (418972.422413, 143704.530223) - (419421.627499, 144004.953907)
    Layer SRS WKT:
    (unknown)
    MESH: String (10.0)
    RAIL_ID: Integer64 (10.0)
    NAME_CHN: String (64.0)
    NAME_TRD: String (64.0)
    NAME_PY: String (160.0)
    NAME_ENG: String (160.0)
    DISP_CLASS: Integer (2.0)
    RAIL_TYPE: Integer (4.0)
    RAIL_LEVEL: Integer (2.0)
    STATUS: Integer (1.0)
    AD_CODE: String (6.0)
    AREA_FLAG: Integer (1.0)
    CREATETIME: String (14.0)
    UPDATETIME: String (14.0)
    OGRFeature(Railway):76
      MESH (String) = J50F001020
      RAIL_ID (Integer64) = 77
      NAME_CHN (String) = µØÌúÁùºÅÏß
      NAME_TRD (String) = µØèFÁù̖¾Q
      NAME_PY (String) = DiTie LiuHao Xian
      NAME_ENG (String) = Subway Line 6
      DISP_CLASS (Integer) = 3
      RAIL_TYPE (Integer) = 5200
      RAIL_LEVEL (Integer) = 3
      STATUS (Integer) = 1
      AD_CODE (String) = (null)
      AREA_FLAG (Integer) = 0
      CREATETIME (String) = (null)
      UPDATETIME (String) = (null)
      LINESTRING (419164.219726560171694 143728.016601560171694,419173.080078120343387 143728.223632810171694,419176.917968750232831 143727.843750000232831,419191.546875000232831 143726.307617190293968,419198.001953120343387 143724.939453120343387,419201.620117190293968 143724.558593750232831,419258.167968750232831 143723.998046870343387,419261.907226560171694 143723.990234370343387)
  • 查询一个shp文件的记录总数:
  • [xingxing.dxx@30_28_6_20 J50F001020]$ ogrinfo -ro  -sql 'select count(*) from Railway' Railway.shp
    INFO: Open of `Railway.shp'
          using driver `ESRI Shapefile' successful.
    
    Layer name: Railway
    Geometry: None
    Feature Count: 1
    Layer SRS WKT:
    (unknown)
    COUNT_*: Integer (0.0)
    OGRFeature(Railway):0
      COUNT_* (Integer) = 78

《ogrinfo使用》有一个想法
  1. Illuderma is a serum designed to deeply nourish, clear, and hydrate the skin. The goal of this solution began with dark spots, which were previously thought to be a natural symptom of ageing. The creators of Illuderma were certain that blue modern radiation is the source of dark spots after conducting extensive research. https://illudermabuynow.us/

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注