📄 drv_oci.html
字号:
<html><head><title>Oracle Spatial</title></head><body bgcolor="#ffffff"><h1>Oracle Spatial</h1>This driver supports reading and writing data in Oracle Spatial (8.1.7 orlater) Object-Relational format. The Oracle Spatial driver is notnormally built into OGR, but may be built in on platforms where theOracle client libraries are available. <p>When opening a database, it's name should be specified in the form"OCI:userid/password@database_instance:table,table". The list of tablesis optional. The database_instance portion may be omitted when accessing the default local database instance.<p>If the list of tables is not provided, then all tables appearing in ALL_SDO_GEOM_METADATA will be treated by OGR as layers with the tablenames as the layer names. Non-spatial tables or spatial tables not listedin the ALL_SDO_GEOM_METADATA table are not accessable unless explicitlylisted in the datasource name. Even in databases where all desired layersare in the ALL_SDO_GEOM_METADATA table, it may be desirable to list onlythe tables to be used as this can substantially reduce initialization timein databases with many tables.<p>If the table has an integer column called OGR_FID it will be used as thefeature id by OGR (and it will not appear as a regular attribute). When loading data into Oracle Spatial OGR will always create the OGR_FID field.<p><h2>SQL Issues</h2>The Oracle driver passes SQL statements directly to Oracle ratherthan evaluating them internally when using the ExecuteSQL() call on theOGRDataSource, or the -sql command option to ogr2ogr. Attribute queryexpressions are also passed through to Oracle.<p>As well two special commands are supported via the ExecuteSQL() interface.These are "<b>DELLAYER:<table_name></b>" to delete a layer, and "<b>VALLAYER:<table_name></b>" to apply the SDO_GEOM.VALIDATE_GEOMETRY() check to a layer. Internally these pseudo-commands are translated into more complex SQL commands for Oracle.<p><h2>Caveats</h2><ul><li> The type recognition logic is currently somewhat impoverished. Noeffort is made to preserve real width information for integer and realfields. <p><li> Various types such as objects, and BLOBs in Oracle will be completelyignored by OGR.<p><li> Currently the OGR transaction semantics are not properly mapped ontotransaction semantics in Oracle.<p><li> If an attribute called OGR_FID exists in the schema for tables being read, it will be used as the FID. Random (FID based) reads on tables withoutan identified (and indexed) FID field can be very slow. To force use of aparticular field name the OCI_FID configuration variable (ie. environmentvariable) can be set to the target field name. <p></ul><h2>Creation Issues</h2>The Oracle Spatial driver does not support creation of new datasets (databaseinstances), but it does allow creation of new layers within anexisting database.<P>Upon closing the OGRDataSource newly created layers will have a spatialindex automatically built. At this point the USER_SDO_GEOM_METADATA tablewill also be updated with bounds for the table based on the features thathave actually been written. One concequence of this is that once a layerhas been loaded it is generally not possible to load additional featuresoutside the original extents without manually modifying the DIMINFO informationin USER_SDO_GEOM_METADATA and rebuilding the spatial index.<p><h3>Layer Creation Options</h3><ul><li> <b>OVERWRITE</b>: This may be "YES" to force an existing layer of thedesired name to be destroyed before creating the requested layer.<p><li> <b>LAUNDER</b>: This may be "YES" to force new fields created on thislayer to have their field names "laundered" into a form more compatible withOracle. This converts to lower case and converts some special characterslike "-" and "#" to "_". The default value is "NO".<p><li> <b>PRECISION</b>: This may be "YES" to force new fields created on thislayer to try and represent the width and precision information, if availableusing NUMBER(width,precision) or VARCHAR2(width) types. If "NO" then the typesNUMBER, INTEGER and VARCHAR2 will be used instead. The default is "YES".<p><li> <b>DIM</b>: This may be set to 2 or 3 to force the dimension of thecreated layer. If not set 3 is used by default.<p><li> <b>INDEX</b>: This may be set to OFF to disable creation of a spatialindex when a layer load is complete. By default an index is created if any of the layer features have valid geometries.<p><li> <b>INDEX_PARAMETERS</b>: This may be set to pass creation parameterswhen the spatial index is created. For instance setting INDEX_PARAMETERS to SDO_LEVEL=5 would cause a 5 level tile index to be used. By default no parameters are passed causing a default R-Tree spatial index to be created.<p><li> <b>DIMINFO_X</b>: This may be set to <xmin>,<xmax>,<xres> values tocontrol the X dimension info written into the USER_SDO_GEOM_METADATA table.By default extents are collected from the actual data written.<p><li> <b>DIMINFO_Y</b>: This may be set to <ymin>,<ymax>,<yres> values tocontrol the Y dimension info written into the USER_SDO_GEOM_METADATA table.By default extents are collected from the actual data written.<p><li> <b>DIMINFO_Z</b>: This may be set to <zmin>,<zmax>,<zres> values tocontrol the Y dimension info written into the USER_SDO_GEOM_METADATA table.By default fixed values of -100000,100000,0.002 are used for layers witha third dimension.<p><li> <b>SRID</b>: By default this driver will attempt to find an existingrow in the MDSYS.CS_SRS table with a well known text coordinate systemexactly matching the one for this dataset. If one is not found, a newrow will be added to this table. The SRID creation option allows the userto force use of an existing Oracle SRID item even it if does not exactlymatch the WKT the driver expects.<p><li> <b>MULTI_LOAD</b>: If enabled new features will be created in groups of 100 per SQL INSERT command, instead of each feature being a separateINSERT command. Having this enabled is the fastest way to load data quickly.Multi-load mode is enabled by default for newly created layers, and may beforced on for existing layers by setting this option to YES, or disabledeven for new layers by setting to NO.<p><li> <b>LOADER_FILE</b>: If this option is set, all feature information willbe written to a file suitable for use with SQL*Loader instead of inserteddirectly in the database. The layer itself is still created in the databaseimmediately. The SQL*Loader support is experimental, and generally MULTI_LOAD enabled mode should be used instead when trying for optimal load performance.<p><li> <b>GEOMETRY_NAME</b>: By default OGR creates new tables with the geometry column named ORA_GEOMETRY. If you wish to use a different name, it can be supplied with the GEOMETRY_NAME layer creation option.<p></ul><h3>Example</h3>Simple translation of a shapefile into Oracle. The table 'ABC' willbe created with the features from abc.shp and attributes from abc.dbf. <p><pre>% ogr2ogr -f OCI OCI:warmerda/password@gdal800.dreadfest.com abc.shp</pre>This second example loads a political boundaries layer from VPF (via the<a href="drv_ogdi.html">OGDI driver</a>), and renames the layer from thecryptic OGDI layer name to something more sensible. If an existing tableof the desired name exists it is overwritten.<p><pre>% ogr2ogr -f OCI OCI:warmerda/password \ gltp:/vrf/usr4/mpp1/v0eur/vmaplv0/eurnasia \ -lco OVERWRITE=yes -nln polbndl_bnd 'polbndl@bnd(*)_line'</pre>This example shows using ogrinfo to evaluate an SQL query statement within Oracle. More sophisticated Oracle Spatial specific queries may also beused via the -sql commandline switch to ogrinfo.<p><pre>ogrinfo -ro OCI:warmerda/password -sql "SELECT pop_1994 from canada where province_name = 'Alberta'"</pre><h3>Credits</h3>I would like to thank <a href="http://www.extendthereach.com/">SRC, LLC</a>for it's financial support of the development of this driver.<p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -