- Import Oracle data using VRT


Bentley Map has been able to import a variety of data using the VRT capabilities from its GDAL commands. One of the little-known types that can be imported is the Oracle Object-Relational format, the precursor to Oracle Spatial. This note will illustrate how to accomplish importing a table of Object-relational data that contains X, Y columns using the OCI (Oracle Call Interface) option into Bentley Map and create a feature layer in the DGN file.

In this example, we show how to setup to import data from an Oracle database using a Point feature table. The XY values will be used as the spatial reference to import the feature into Bentley Map. The import process will retain all of the other properties that are defined for that feature.

The screen shot below shows the data as it exists in the Oracle database. We will be importing all of these Monument features into Bentley Map. 

 

 

What is the VRT file?

The VRT (Virtual Datasource) file describes the datasource so that it can be easily imported into Bentley Map. It is an XML format file that describes the format of the source data. See the appendix for more details on VRT capabilities.

A sample VRT file is shown below. Each line of the file defines a different aspect of the source data.


 

If we look at these lines separately, the breakdown is as follows:

<OGRVRTLayer name=”Monument”> = Name of Feature (to be imported).

<SrcDataSource>OCI:bentley/bentley@TSGorcl11G:MONUMENTS</SrcDataSource> = Source for feature. The connection string should be added to this line in the format username/password@databasename.

<SrcLayer>MONUMENTS</SrcLayer> = Oracle Table name that we are connecting to. This is required when the Oracle database is not Spatial.

<GeometryType>wkbPoint</GeometryType> = The Type of Feature to be imported.

<LayerSRS>WGS84<LayerSRS> = Spatial Reference.

<GeometryField encoding=”PointFromColumns” x=”X” y=”Y”/> = The column names containing the X and Y values.

 

Note: other examples of the VRT file can be found in the Bentley Map Help file.

  

Once the VRT file has been created, the Bentley Map Interoperability tool will be used to import this file. In Bentley Map, select File > Map Interoperability to open the dialog.

On the Imports tab of the Interoperability dialog, right-click on the Imports directory and select New Import. A new import Import will be displayed. Right-click on Import1 and select Add File…. On the Open File dialog,  set the File Type drop down to All Files. Browse to the location of the VRT file that was created and open it.

The feature name defined in the VRT ('Monuments’ in this example) will be listed in the Imports dialog . The data can be imported via a right-click on the feature name.

  

 

After the import is complete, you will see your features in Bentley Map. The screen shot below shows the results of the sample data that was imported. You can see the features in the view and the feature properties are displayed using both the Data Browser and Analyze tools.


 

 

Appendix

GDAL Translator - http://www.gdal.org/

GDAL Virtual Format - http://www.gdal.org/drv_vrt.html

GDAL & Oracle Spatial - http://www.gdal.org/drv_oci.html

Oracle Call Interface - http://www.oracle.com/technetwork/database/features/oci/index-090945.html