ogr2ogr使用

简介

  • org2ogr是OGR模块中提供的一个重要工具,用于对数据源进行格式转换

使用方式

  • 命令行参数
  • [xingxing.dxx@30_28_6_20 J50F001020]$ ogr2ogr --long-usage
    Usage: ogr2ogr [--help-general] [-skipfailures] [-append] [-update]
                   [-select field_list] [-where restricted_where]
                   [-progress] [-sql <sql statement>] [-dialect dialect]
                   [-preserve_fid] [-fid FID]
                   [-spat xmin ymin xmax ymax] [-spat_srs srs_def] [-geomfield field]
                   [-a_srs srs_def] [-t_srs srs_def] [-s_srs srs_def]
                   [-f format_name] [-overwrite] [[-dsco NAME=VALUE] ...]
                   dst_datasource_name src_datasource_name
                   [-lco NAME=VALUE] [-nln name] 
                   [-nlt type|PROMOTE_TO_MULTI|CONVERT_TO_LINEAR]
                   [-dim 2|3|layer_dim] [layer [layer ...]]
    
    Advanced options :
                   [-gt n] [-ds_transaction]
                   [[-oo NAME=VALUE] ...] [[-doo NAME=VALUE] ...]
                   [-clipsrc [xmin ymin xmax ymax]|WKT|datasource|spat_extent]
                   [-clipsrcsql sql_statement] [-clipsrclayer layer]
                   [-clipsrcwhere expression]
                   [-clipdst [xmin ymin xmax ymax]|WKT|datasource]
                   [-clipdstsql sql_statement] [-clipdstlayer layer]
                   [-clipdstwhere expression]
                   [-wrapdateline][-datelineoffset val]
                   [[-simplify tolerance] | [-segmentize max_dist]]
                   [-addfields] [-unsetFid]
                   [-relaxedFieldNameMatch] [-forceNullable] [-unsetDefault]
                   [-fieldTypeToString All|(type1[,type2]*)] [-unsetFieldWidth]
                   [-mapFieldType srctype|All=dsttype[,srctype2=dsttype2]*]
                   [-fieldmap identity | index1[,index2]*]
                   [-splitlistfields] [-maxsubfields val]
                   [-explodecollections] [-zfield field_name]
                   [-gcp pixel line easting northing [elevation]]* [-order n | -tps]
                   [-nomd] [-mo "META-TAG=VALUE"]*

     

例子

  • shape 转mapinfo文件
  • ogr2ogr  -f "MapInfo File" -fieldTypeToString "Integer64" road Railway.shp

     

  • shape转GeoJSON格式
  • ogr2ogr  -f "GeoJSON" -fieldTypeToString "Integer64" road Railway.shp

     

  • shape转wkt格式
  • ogr2ogr -lco "GEOMETRY=AS_WKT" -lco "SEPARATOR=TAB" -f CSV railway.csv -sql "select LUA_ID from LandUseArea" LandUseArea.shp 

     

你可能感兴趣的:(ogr2ogr使用)