Importing Microsoft Access data into Microstation
Details methods to import GPS data into Bentley map from CVS files, Microsoft Access databases, and text files.
This page refers to functionality that is available in the Bentley Map environment, which is an extension to Microstation, if you do not have the Bentley Map extension installed on your machine, then you should read the page that describes the GPS import methods available in the Microstation functionality, found here: INSERT LINK SIMON.
There are a number of different ways that GPS data (usually stored in text files) can be imported into the Bentley Map environment. This page will focus only on the steps required for importing GPS data that is NOT already in an importable format. for importing GPS data that is already in an importable format, see Importing GIS data into Bentley Map (Microstation).
Method 1 - Importing from a Comma Delimited text file (CSV)
Using a .VRT file, GPS data that is in a comma delimited text file can be imported and manipulated in the same ways as described in Importing GIS data into Bentley Map (Microstation). To enable the CSV to be importable, you must first create the .vrt file, which can be done in any simple text editor.
the VRT file is a small piece of xml and looks like this:
<OGRVRTDataSource>
<OGRVRTLayer name = "testCoords">
<SrcDataSource>testCoords.csv</SrcDataSource>
<GeometryType>wkbPoint</GeometryType>
<LayerSRS>WGS84</LayerSRS>
<GeometryField encoding="PointFromColumns" x="longitude" y="latitude"/>
</OGRVRTLayer>
</OGRVRTDataSource>
To create your VRT do the following
1. copy /paste the above code into a text editor (such as notepad).
2. Adjust the following variables in the xml code
- OGRVRTLayer name
- Should be the same as the name in "SrcDataSource" but WITHOUT the ".csv" suffix.
- SrcDataSource
- Should be the exact name of the file, with the .csv extension
- GeometryType
- As shown in the code, it is unknown to the author at this stage if other geometry types are available.
- LayerSRS
- Must be the correct coordinate system reference - NOTE: SO FAR ONLY "WGS84" HAS FOUND TO WORK FOR THIS SO FAR
- GeometryField
- Keep the encoding value as it is ("PointFromColumns"), but adjust the x & y values to the correct column names in your csv file.
3. Now save the file to the SAME DIRECTORY as your .csv file, but be sure to set the "files of type" to "all Files, and add the ".vrt" file extension to the end of the file name.
4. You can now open the VRT file in the same fashion as described in Importing GIS data into Bentley Map (Microstation)Method 2 - Importing from a Microsoft Access database
The method for importing data from a Microsoft Access database into Bentley Map is not as straight forward as it is in other programs. the basic steps are:
- Establish an ODBC connection through the control panel that points to your database.
- Create a VRT (similar to what is described above) and reference the ODBC connection.
- Follow the steps outlined in Importing GIS data into Bentley Map (Microstation) to bring the data in as a layer.
1. Create an ODBC connection
- Click the Start Menu and select 'Control Panel'
- Click the Administrative Tools option in the control panel
- Click ODBC Sources
- In the dialog that displays, click the System DSN tab, and click the 'Add' button.
- Select the Microsoft Access Driver, and click 'Finish', the ODBC Microsoft Access Setup displays.
- Type in a name for the ODBC connection, in this example, type GPS_DATA, and give it a description.
- then click the 'Select' button to define which database you should be connecting to.
- In the dialog that shows, first select the drive at the bottom, then the folder in the right list pane, finally highlight the .mdb file in the left listpane, then click 'ok' to exit and the exit the ODBC sources dialog completely.
- Open your Access database and double check the table you want to import HAS NO SPACES in its name, the import will not work if it does.
2. Create your VRT file.
The VRT file for your microsoft Access database should look like this:
<OGRVRTDataSource>
<OGRVRTLayer name = "odbcInport">
<SrcDataSource>ODBC:GPS_DATA</SrcDataSource>
<SrcLayer>gpsPoints</SrcLayer>
<GeometryType>wkbPoint</GeometryType>
<LayerSRS>WGS84</LayerSRS>
<GeometryField encoding="PointFromColumns" x="longitude" y="latitude"/>
</OGRVRTLayer>
</OGRVRTDataSource>
Note there is an extra property, called SrcLayer, which refers to a table in the ODBC database. the ODBC data source is defined in the SrcDataSource property. The SrcLayer must NOT HAVE ANY SPACES IN ITS NAME.
3. Import the Access data through the Interoperability window
Theoretically, you can now import the Microsoft Access database table in the same as described here: Importing GIS data into Bentley Map (Microstation) HOWEVER - browsing the data may not work.
