📄 drv_vrt.html
字号:
<html><head><title>Virtual Format</title></head><body bgcolor="#ffffff"><h1>Virtual Format</h1>OGR Virtual Format is a driver that transforms features read from otherdrivers based on criteria specified in an XML control file. It is primarilyused to derive spatial layers from flat tables with spatial information inattribute columns. It can also be used to associated coordinate systeminformation with a datasource, merge layers from different datasources intoa single data source, or even just to provide an anchor file for access to non-file oriented datasources.<p>The virtual files are currently normally prepared by hand.<p><h2>Creation Issues</h2>Currently the ODBC VRT driver is read-only, so new features, tables anddatasources cannot normally be created by OGR applications. This limitationmay be removed in the future. <p><h1>Virtual File Format</h1>The root element of the XML control file is <b>OGRVRTDataSource</b>. It hasan <b>OGRVRTLayer</b> child for each layer in the virtual datasource. Thatelement may have the following subelements:<ul><li> <b>SrcDataSource</b> (manditory): The value is the name of the datasourcethat this layer will be derived from. The element may optionally havea <b>relativeToVRT</b> attribute which defaults to "0", but if "1" indicatesthat the source datasource should be interpreted as relative to the virtualfile. This can be any OGR supported dataset, including ODBC, CSV, etc.<p><li> <b>SrcLayer</b> (optional): The value is the name of the layer on thesource data source from which this virtual layer should be derived. If thiselement isn't provided, then the SrcSQL element must be provided.<p><li> <b>SrcSQL</b> (optional): An SQL statement to execute to generate thedesired layer result. This should be provided instead of the SrcLayer forstatement derived results. Some limitations may apply for SQL derived layers.<p> <li> <b>FID</b> (optional): Name of the attribute column from which the FID of features should be derived. If not provided, the FID of the sourcefeatures will be used directly.<p><li> <b>GeometryType</b> (optional): The geometry type to be assigned to the layer. If not provided it will be taken from the source layer. The value shouldbe one of "wkbNone", "wkbUnknown", "wkbPoint", "wkbLineString", "wkbPolygon", "wkbMultiPoint", "wkbMultiLineString", "wkbMultiPolygon", or "wkbGeometryCollection". Optionally "25D" may be appended to mark it as including Z coordinates. Defaults to "wkbUnknown" indicating that any geometry type is allowed.<p><li> <b>LayerSRS</b> (optional): The value of this element is the spatialreference to use for the layer. If not provided, it is inherited from thesource layer. The value may be WKT or any other input that is acceptedby the OGRSpatialReference::SetUserInput() method. <p><li> <b>GeometryField</b> (optional): This element is used to definehow the geometry for features should be derived. If not provided thegeometry of the source feature is copied directly. The type of geometryencoding is indicated with the <b>encoding</b> attribute which may have thevalue "WKT", "WKB" or "PointFromColumns". If the encoding is "WKT" or "WKB" then the <b>field</b> attribute will havethe name of the field containing the WKT or WKB geometry. If the encoding is "PointFromColumns" then the <b>x</b>, <b>y</b> and <b>z</b> attributeswill have the names of the columns to be used for the X, Y and Z coordinates.The <b>z</b> attribute is optional.<p></ul><h2>Example: ODBC Point Layer</h2>In the following example (disease.ovf) the worms table from the ODBCdatabase DISEASE is used to form a spatial layer. The virtual file uses the "x" and "y" columns to get the spatial location. It also marksthe layer as a point layer, and as being in the WGS84 coordinate system.<p><pre><OGRVRTDataSource> <OGRVRTLayer name="worms"> <SrcDataSource>ODBC:DISEASE,worms</SrcDataSource> <SrcLayer>worms</SrcLayer> <GeometryType>wkbPoint</GeometryType> <LayerSRS>WGS84</LayerSRS> <GeometryField encoding="PointFromColumns" x="x" y="y"/> </OGRVRTLayer></OGRVRTDataSource></pre><h2>Other Notes</h2><ul><li> When the GeometryField is "WKT" spatial filtering is appliedafter extracting all rows from the source datasource. Essentially that meansthere is no fast spatial filtering on WKT derived geometries. <p><li> When the GeometryField is "PointFromColumns", and a SrcLayer (as opposedto SrcSQL) is used, and a spatial filter is in effect on the virtual layerthen the spatial filter will be internally translated into an attribute filteron the X and Y columns in the SrcLayer. In cases where fast spatial filteringis important it can be helpful to index the X and Y columns in the sourcedatastore, if that is possible. For instance if the source is an RDBMS. <p><li> Normally the SrcDataSource is a non-spatial tabular format (such asMySQL, SQLite, CSV, or ODBC) but it can also be a spatial database in whichcase the geometry can be directly copied over. <p></ul></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -