`
nlslzf
  • 浏览: 1039998 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

ogr2ogr 参数大全

阅读更多
http://www.gdal.org/ogr2ogr.html
converts simple features data between file formats
Usage:


Usage: ogr2ogr [--help-general] [-skipfailures] [-append] [-update] [-gt n]
               [-select field_list] [-where restricted_where]
               [-progress] [-sql <sql statement>] [-dialect dialect]
               [-preserve_fid] [-fid FID]
               [-spat xmin ymin xmax ymax] [-wrapdateline]
               [-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]
               [-a_srs srs_def] [-t_srs srs_def] [-s_srs srs_def]
               [-f format_name] [-overwrite] [[-dsco NAME=VALUE] ...]
               [-segmentize max_dist] [-fieldTypeToString All|(type1[,type2]*)]
               dst_datasource_name src_datasource_name
               [-lco NAME=VALUE] [-nln name] [-nlt type] [layer [layer ...]]

This program can be used to convert simple features data between file formats performing various operations during the process such as spatial or attribute selections, reducing the set of attributes, setting the output coordinate system or even reprojecting the features during translation.


-f format_name:
output file format name (default is ESRI Shapefile), some possible values are:
     -f "ESRI Shapefile"
     -f "TIGER"
     -f "MapInfo File"
     -f "GML"
     -f "PostgreSQL"

-append:
Append to existing layer instead of creating new
-overwrite:
Delete the output layer and recreate it empty
-update:
Open existing output datasource in update mode rather than trying to create a new one
-select field_list:
Comma-delimited list of fields from input layer to copy to the new layer. A field is skipped if mentioned previously in the list even if the input layer has duplicate field names. (Defaults to all; any field is skipped if a subsequent field with same name is found.)
-progress:
(starting with GDAL 1.7.0) Display progress on terminal. Only works if input layers have the "fast feature count" capability.
-sql sql_statement:
SQL statement to execute. The resulting table/layer will be saved to the output.
-dialect dialect:
SQL dialect. In some cases can be used to use (unoptimized) OGR SQL instead of the native SQL of an RDBMS by passing OGRSQL.
-wrapdateline:
(starting with GDAL 1.7.0) split geometries crossing the dateline meridian (long. = +/- 180deg)
-where restricted_where:
Attribute query (like SQL WHERE)
-skipfailures:
Continue after a failure, skipping the failed feature.
-gt n:
group n features per transaction (default 200)
-spat xmin ymin xmax ymax:
spatial query extents. Only features whose geometry intersects the extents will be selected. The geometries will not be clipped unless -clipsrc is specified
-clipsrc [xmin ymin xmax ymax]|WKT|datasource|spat_extent:
(starting with GDAL 1.7.0) clip geometries to the specified bounding box (expressed in source SRS), WKT geometry (POLYGON or MULTIPOLYGON), from a datasource or to the spatial extent of the -spat option if you use the spat_extent keyword. When specifying a datasource, you will generally want to use it in combination of the -clipsrclayer, -clipsrcwhere or -clipsrcsql options
-clipsrcsql sql_statement:
Select desired geometries using an SQL query instead.
-clipsrclayer layername:
Select the named layer from the source clip datasource.
-clipsrcwhere expression:
Restrict desired geometries based on attribute query.
-clipdst xmin ymin xmax ymax:
(starting with GDAL 1.7.0) clip geometries after reprojection to the specified bounding box (expressed in dest SRS), WKT geometry (POLYGON or MULTIPOLYGON) or from a datasource. When specifying a datasource, you will generally want to use it in combination of the -clipdstlayer, -clipdstwhere or -clipdstsql options
-clipdstsql sql_statement:
Select desired geometries using an SQL query instead.
-clipdstlayer layername:
Select the named layer from the destination clip datasource.
-clipdstwhere expression:
Restrict desired geometries based on attribute query.
-dsco NAME=VALUE:
Dataset creation option (format specific)
-lco NAME=VALUE:
Layer creation option (format specific)
-nln name:
Assign an alternate name to the new layer
-nlt type:
Define the geometry type for the created layer. One of NONE, GEOMETRY, POINT, LINESTRING, POLYGON, GEOMETRYCOLLECTION, MULTIPOINT, MULTIPOLYGON or MULTILINESTRING. Add "25D" to the name to get 2.5D versions.
-a_srs srs_def:
Assign an output SRS
-t_srs srs_def:
Reproject/transform to this SRS on output
-s_srs srs_def:
Override source SRS
-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.
-segmentize max_dist:
(starting with GDAL 1.6.0) maximum distance between 2 nodes. Used to create intermediate pointsspatial query extents
-fieldTypeToString type1, ...:
(starting with GDAL 1.7.0) converts any field of the specified type to a field of type string in the destination layer. Valid types are : Integer, Real, String, Date, Time, DateTime, Binary, IntegerList, RealList, StringList. Special value All can be used to convert all fields to strings. This is an alternate way to using the CAST operator of OGR SQL, that may avoid typing a long SQL query.
Srs_def can be a full WKT definition (hard to escape properly), or a well known definition (ie. EPSG:4326) or a file with a WKT definition.

Example appending to an existing layer (both flags need to be used):


% ogr2ogr -update -append -f PostgreSQL PG:dbname=warmerda abc.tab

Example reprojecting from ETRS_1989_LAEA_52N_10E to EPSG:4326 and clipping to a bounding box


% ogr2ogr -wrapdateline -t_srs EPSG:4326 -clipdst -5 40 15 55 france_4326.shp europe_laea.shp

More examples are given in the individual format pages.

分享到:
评论

相关推荐

    ogr2ogr — GDAL文档_格式转换_gis_pdf_Linuxogr2ogr安装_

    ogr2ogr是GDAL(Geospatial Data Abstraction Library)的一部分,它是一个强大的开源库,用于处理多种地理空间数据格式。这个工具的主要功能是进行数据转换,它支持大量的GIS(地理信息系统)数据格式,包括矢量和...

    ogr2ogr将shp文件导入到Mysql.zip

    - **数据类型不兼容**:检查Shapefile字段类型与MySQL表字段类型是否兼容,如有需要,可以使用 ogr2ogr 的 `-nlt` 参数指定几何类型。 6. **优化与注意事项**:为了提高性能,可以考虑使用InnoDB引擎代替MyISAM,...

    一个好用的各种空间数据转换工具ogr2gui

    标题中的“一个好用的各种空间数据转换工具ogr2gui”指的是OGR2GUI,这是一个基于开源库GDAL(Geospatial Data Abstraction Library)的图形用户界面应用,用于方便地进行空间数据格式之间的转换。GDAL是处理地理...

    GisConvert:转换 GIS 数据的工具 (Ogr2Ogr GUI)

    GIS转换工具GisConvert,基于开源的Ogr2Ogr库,是一款强大的地理信息系统数据转换软件。Ogr2Ogr是GDAL(Geospatial Data Abstraction Library)的一部分,用于处理多种格式的地理空间数据。GDAL是一个强大的开源库,...

    OGR帮助文档(html)

    2. **数据模型**:OGR提供了简单的特征(Feature)模型,每个特征包含几何对象(Geometry)和属性字段(Attribute Field)。几何对象可以是点、线或多边形等,属性字段则存储与几何相关的元数据。 3. **数据读写...

    shell_scripts:使用GDAL和OGR2OGR进行批处理地理处理的Bash Shell脚本

    在IT行业中,GIS(地理信息系统)是用于处理和分析地理数据的重要工具,而GDAL(Geospatial Data Abstraction Library)和OGR2OGR则是GIS领域的两个关键组件。这两个开源库提供了强大的功能,用于读取、转换和操作...

    GDAL之OGR入门

    ##### 2. 打开数据源 ```cpp OGRDataSource *poDS = OGRSFDriverRegistrar::Open("point.shp", FALSE); // FALSE表示只读模式 if (poDS == NULL) { printf("Open failed.\n"); exit(1); } ``` 这里使用`...

    gdal_help.rar_GDAL_OGR_gdal开发

    2. **数据读写**:OGR提供API,用于读取、创建和编辑矢量数据,支持多种操作,如添加、删除、修改特征,以及创建新的图层。 3. **几何对象**:OGR定义了一套通用的几何对象,如点、线串、多边形等,方便在不同格式...

    ogrtool:OGR 工具的命令行实用程序包装器

    ogrtool是一个命令行实用程序,它封装了用于操作地图数据的ogr2ogr程序。 它旨在使重复性任务更简单,更容易记住如何做(并简化自动化)。 不要太当真,主要是让我作为非程序员的生活更轻松。 安装 首先模板连接文件...

    基于OGR库的S-57标准电子海图到Shapefile格式的转换.docx

    为了将读取的海图数据更好地存储起来,定义了转换过程中所需的数据参数描述、特征记录和空间记录类。根据空间记录元素之间的拓扑关系,定义了CPointFeature、CLineFeature和CAreaFeature 3个类,分别用于存储描述点...

    解决python ogr shp字段写入中文乱码的问题

    在创建数据源之前,使用`gdal.SetConfigOption()`设置两个参数: - `GDAL_FILENAME_IS_UTF8` 设置为 "YES",告诉GDAL文件名是UTF-8编码。 - `SHAPE_ENCODING` 设置为 "GBK" 或者其他合适的编码,如 "UTF-8",指定...

    GDAL\OGR读取数据示例 C#版本

    2. **OGR数据读取**:OGR通过`Ogr.Open`方法读取矢量数据,返回一个`DataSource`对象。你可以列举图层`dataSource.GetLayerCount()`,并访问每个图层`dataSource.GetLayer(index)`,图层中的特征可以通过`layer....

    栅格、矢量结构在空间数据融合中的技术及应用

    - **设备参数读取与验证**:确保模型中的参数准确无误。 - **状态估计**:基于实时数据估计电网状态。 **2. 状态估计** 状态估计是EMS(能量管理系统)的核心组成部分,其目标是构建一个完整且可靠的实时网络状态...

    利用工具将shp文件导入到oracle spatial中

    导入SHP文件到Oracle Spatial时,可以使用多种工具,如Oracle Data Integrator (ODI)、FME (Feature Manipulation Engine)、 ogr2ogr(GDAL库的一部分)等。这些工具提供了图形化界面或命令行接口,方便用户进行...

    将shp文件导入到mysql的命令.zip

    在GIS(地理信息系统)领域,SHP文件是一...注意,根据SHP文件的具体内容和需求,可能需要调整数据类型、坐标系或其他 ogr2ogr 参数。同时,为了性能考虑,建议使用InnoDB引擎代替MyISAM,并启用InnoDB的Spatial扩展。

    清除空间变换参数

    除此之外, ogr_*.dll 和 osr_*.dll 文件与GDAL的矢量数据处理部分有关,它们处理地理空间数据如形状文件和坐标系统。`gdalconst_*.dll`和`gdalconst_wrap.dll`则包含了GDAL库中常量定义的相关功能。 总的来说,...

    Mapgis文件转换为Arcgis支持的SHP文件的方法总结

    在2009年12月10日这个时间点,常见的转换工具可能包括MapGIS自身的导出功能,以及第三方软件如FME(Feature Manipulation Engine)或ogr2ogr(GDAL库的一部分)。 ogr2ogr是一款开源命令行工具,可以处理多种GIS...

    KML_to_SHP

    2. **使用GDAL/OGR**:通过GDAL/OGR的`ogr2ogr`命令,我们可以实现KML到SHP的转换。基本命令格式如下: ``` ogr2ogr -f "ESRI Shapefile" 输出.shp 输入.kml ``` 其中,`输入.kml`是你的KML文件路径,`输出.shp`...

    谷歌kml/kmz文件转ArcGIS shapefile文件保留属性

    这个脚本可能利用了像是`geopandas`、`ogr2ogr`或`pykml`等Python库来处理地理空间数据。 "运行说明.swf"可能是一个Flash动画教程或指南,提供了关于如何使用`kml2shp.py`脚本的步骤和说明。SWF是Adobe Flash ...

    FWtools 2.4.7

    ogr2ogr是FWtools中的关键组件,它是一个多功能的地理数据转换工具,支持多种数据格式间的转换,包括ESRI的Shapefile、PostGIS数据库、KML、GML等。在FWtools 2.4.7中, ogr2ogr可以用于将shapefile数据转换为MySQL...

Global site tag (gtag.js) - Google Analytics