Exporting DGN Data To ESRI Shapefile Format With MicroStation GeoGraphics [CS]



 

This Client Server article is republished in its entirety from 2006 for reference purposes. It was written for MicroStation GeoGraphics v08.05.02.11 and MicroStation v08.05.02.35 and may not apply to any other version.

By Nelson Hobdell, Senior Technical Support Analyst
07 August 2006 Modified: 12 December 2008

Synopsis:

This article discusses export of DGN elements to ESRI shapefile format using MicroStation GeoGraphics, from the perspective of someone who does not use MicroStation GeoGraphics. A basic understanding of MicroStation is required.

The DGN data may or may not have attribute information linked from a database.

Overview:

Installation, licensing

Preparing the example project for your data

Creating GeoGraphics features

Assigning features to elements

Exporting features

Attribute data

Installation

Software required:

Microsoft Windows: Any supported release, including ODBC connectivity
MicroStation GeoGraphics 2004 Edition: 08.05.02.11
MicroStation V8 2004 Edition: 08.05.02.35
MicroStation and MicroStation GeoGraphics are both available via SELECTservices Online (http://selectservices.bentley.com/) in the downloads and updates section. A valid SELECT Contact ID with download privileges is required to download software. If you need assistance with login or privileges, please first contact your company's in-house SELECT Services Administrator. Subsequent inquiries can be made to the Bentley Administration Center for your region. (In the United States: 1-800-513-5103.)

MicroStation GeoGraphics is a MicroStation Extension. Each seat of MicroStation covered by a SELECT contract is typically allotted one extension, licensed free of charge. For details regarding availability for your account, please contact the Bentley Administration Center for your region.

When installing MicroStation:

-Select a new or empty directory for the installation.

Installation over a previous version can cause conflicts with pre-existing settings and configuration files when programs such as GeoGraphics are used.

 

Figure 1

-Include the MicroStation Databases component when installing.

If utilizing a pre-existing copy of MicroStation, check to ensure that databases have been installed by locating the folder:

...\Program\MicroStation\database\

This folder should include at least the ODBC subdirectory, as a Microsoft Access *.MDB file will be utilized in this example as the database connection.

 

Figure 2

When installation finishes for MicroStation, the MicroStation Program Group is displayed. Leave this dialog box open.

When installing GeoGraphics:

-As multiple copies of MicroStation may exist on a system, GeoGraphics will attempt to install to the location of the most recent MicroStation installation. Be certain that you are installing to the desired location.

-Include the GeoGraphics Sample Projects/Example Files component.

Figure 3

When installation finishes for GeoGraphics, the MicroStation Program Group includes the icons used to launch GeoGraphics and the GeoGraphics sample projects. Leave this dialog box open.

 

Figure 4

Licensing:

If you are accessing an existing SELECTserver installation with the appropriate licenses available:

- Create a text file in the ...\Bentley\Program\Licensing\ directory.

- Name the file "MSV8.lic".

- Using a text editor such as Notepad, edit the file to define the location of SELECTserver Licensing. For example, the text file pointing to "mylicenseserver" would read: SERVER=mylicenseserver

 

If you have obtained a node locked or evaluation license, follow the instructions delivered with the license.

Preparing the example project for your data

The GeoGraphics Sample Projects/Example Files component includes multiple examples, including the mytown project. We will use this project as a surrogate for our export procedure. Of course, experienced GeoGraphics users can use their pre-existing projects.

To use the mytown project, a connection must be established to the database component of the project. We will use the Microsoft Access version of the mytown database for this project. To set up the connection, we must define a data source name (DSN) via the Microsoft ODBC Administrator.

 

- Open the Microsoft ODBC Administrator:

Start->Settings->Control Panel->Administrative Tools->Data Sources (ODBC)

- Choose the ‘User DSN' tab

- Select the ‘Add' button

- Select ‘Microsoft Access Driver (*.MDB) from the drivers list.

 

Figure 5

- Click Finish

- Input the ‘Data Source Name' as ‘mytown' [We use ‘mytown' because the GeoGraphics icon titled "MicroStation GeoGraphics Mytown (ODBC)" (see Figure 4) is preconfigured to look for this DSN.]

- Click Select and browse to the delivered mytown.mdb file:

....\Bentley\Workspace\Projects\Examples\Geospatial\mytown\mytown.mdb

 

Figure 6

- Click OK to complete the definition.

 

Figure 7

- You are returned to the main ODBC Administrator screen and should see ‘mytown' as a data source name in the User DSN tab.

Figure 8

-Click OK to close the ODBC Administrator dialog box.

 

Launch the mytown project by clicking the "MicroStation GeoGraphics Mytown (ODBC)" icon.

 

The design file ‘work.dgn' is loaded and the project opens automatically.

 

Note: If a project is opened with the ‘Work Map' toggle engaged, the software will attempt to overwrite "work.dgn". Be sure that you do not overwrite the file in this process. You should "save as" a different name to prevent this.

 

To confirm that the project has opened, select the GeoGraphics ‘Project' menu. The ‘open' option is disabled, indicating that the project is in the open state.

 

Figure 9

Creating features

GeoGraphics can create ESRI shapefiles for the following ESRI topology types:

* Point
* Line
* Polygon

Each ESRI shapefile produced can only contain elements appropriate to one of the ESRI topology types. This rule is reinforced by the use of GeoGraphics features as the export medium and their Theme Type setting.

Refer to the topology matrix below to see which GeoGraphics Theme Types suit creation of the desired ESRI shapefile topology type. Options highlighted in light blue are demonstrated in this article.

 

ESRI Shapefile Topology

           
GeoGraphics Feature: Theme Types PointsText*Spot HeightsLabel*LineContourBreak LineAreaVoid AreaDTM BoundaryArea Centroid + Area Boundary
             
 Point

X

X

X

X

 

      
 Line    

X

X

X

    
 Polygon       

X

X

X

X

 

 

*Text and label features are exported as ESRI point topology. When exporting, any text from the element itself will not be exported. To export text attributes, the text information must be must be included as attribute information within a database attribute table. The destination software can then be used to again annotate the data with the desired text.

 

We will create new feature definitions for our export data for each of the above options, and subsequently assign these definitions to elements (‘featurization') prior to export.

 

- Select Project->Close to close the project.

- Select Project->Setup.

- Click Open in the Project Setup interface.

- Select Tables->Feature Setup.



Figure 10

The Feature Setup dialog box shows us that features are grouped within categories. The broader purpose of the category/feature relationship is beyond the scope of this article. Refer to your GeoGraphics documentation for more information about that topic.

We will create one category specifically to contain five features to be used for export.

- Select the existing category ‘Grids and Graticules'.

- Overwrite the displayed category name and enter ‘EXPORT' as the new category name.

 

Figure 11

- Overwrite the displayed category extension and enter ‘dgn' as the new category file extension.

- Toggle on the ‘Allow Foreign' option.

- Click the ‘Insert' button to create the new category.

 

Figure 12

Create a new feature by populating the ‘Feature' section of the dialog box:

- Enter 1 as the (feature) Code.

- Enter ‘EXPORT_POINT' as the (feature) name.

- Click Insert to create the new feature.

- Modify the feature's Theme Type to Point Feature.

- Set the line weight of the Feature to 4

- Click Update to update the feature with your changes.

 

Figure 13

Create the remaining features using the following specifications:

 

FEATURE CODE : 2

NAME: : EXPORT_LINE

THEME TYPE : Line Feature

COLOR : 1

WEIGHT : 1

 

FEATURE CODE : 3

NAME: : EXPORT_SHAPE

THEME TYPE : AREA Feature

COLOR : 2

WEIGHT : 1

 

FEATURE CODE : 4

NAME: : EXPORT_CENTROID

THEME TYPE : AREA CENTROID

COLOR : 3

WEIGHT : 4

 

FEATURE CODE : 5

NAME: : EXPORT_BOUNDARY

THEME TYPE : AREA BOUNDARY

COLOR : 4

WEIGHT : 1


 

Figure 14

When finished, click Commit to save your changes to the database and close the Feature Setup and Project Setup dialog boxes. Stay in the MicroStation GeoGraphics session.

Creating and featurizing elements for export

We'll now create elements within the delivered work.dgn to test featurization and export. The user's goal of course is to utilize existing data for export, but continuing with this portion of the exercise is recommended prior to attempting featurization of existing data. In all cases, users should work with a copy of their existing data until they are comfortable with all aspects of GeoGraphics featurization.

Reopen the GeoGraphics project (Project->Open).

Set the active level to Default.

Set the active weight to 4.

Create the following elements in whatever manner you are comfortable with. (Ensure that no other elements exist within these shapes.) In this example we will create three of each, and will list the associated MicroStation key-in command (Utilities->Key-in):

 

POINT (Key-in: PLACE POINT)

LINE (Key-in: PLACE LINE)

SHAPE (Key-in: PLACE SHAPE)

 

Figure 15

Continue by creating three polygons, made of line elements.

Within these polygons, place one point each. These parcel-style areas may be contiguous.

 

Figure 16

Featurizing

When we featurize an element with GeoGraphics, we are actually creating a database linkage on the element from the GeoGraphics project's feature table.

We'll first featurize the points.

- Place a fence around the elements to be featurized.

- Open the GeoGraphics Feature Manager (Utilities->Feature Manager).

- Locate and select the EXPORT category.

- Double-click EXPORT_POINT feature to make it the active feature.

You will notice that the Active Level has become EXPORT_POINT.

 

Figure 17

- Open the GeoGraphics Features tool frame

- (Tools->GeoGraphics->Features)

- Select the Place Active Feature tool.

- Toggle on the Use Fence option from the MicroStation tool settings dialog.

 

Figure 18

- You are prompted to Attach Feature to Fence Contents...

- Place a datapoint in the view to accept.

Repeat the operation for the lines and shapes, activating the Feature EXPORT_LINE for each line and EXPORT_SHAPE for each shape.

To assign the features EXPORT_CENTROID and EXPORT_BOUNDARY, create a selection set of the elements to be featurized. Untoggle the Use Fence option when the Attach Feature tool is activated.

When attaching Features to mixed element types which are geographically commingled, remember these options:

- Attach Feature can operate on an individual element, a fence or a selection set.

- Selection sets can be created from the MicroStation ‘Select by attributes' tool

- Elements slated for different Features which exist on separate levels can easily be separated out of the current operation by turning level display off for all but the targeted elements.

Users wishing to further automate the process should investigate the GeoGraphics Best Feature Assignment documentation:

(Help-> GeoGraphics Contents...)

User Guide -> Data Setup -> Attach Best Feature

 

You will notice that during featurization, element symbology (including level assignment) is modified. This is the primary reason that working on a copy of your existing data is strongly recommended until you are familiar with the effects of featurization. In cases where the level assigned to the element is not present within the design file, the level will be created on demand. Details of this mechanism and alternate settings can be viewed within the GeoGraphics readme file, by searching on the phrase: MicroStation V8 - 2004 Edition Level Integration

 

Figure 19

Exporting features

For this example, we will create a new directory within the project directory to store the exported files. Of course, users may choose their own directory and file names for the resulting file.

Create:

...Bentley\Workspace\Projects\Examples\Geospatial\mytown\exp\

 

- Open the GeoGraphics Export dialog box (File->Export->SHP/MIF...)

The Export dialog box displays all valid features found in the current session,. This includes reference files and attached GeoGraphics maps. Valid discovered features are grouped into the three topology types available for export shown previously in our topology matrix.

The export file name defaults to:

...Bentley\Workspace\Projects\Examples\Geospatial\mytown\exportfile

 

-Set the name and location of the export file to the new directory.

Use the feature's name as the name of the exported file:

 

...Bentley\Workspace\Projects\Examples\Geospatial\mytown\EXPORT_POINT

 

Note that since the Shapefile is a conglomeration of three separate files (*.shp, *.shx, and *.dbf), the file extensions are assumed and need not be added.

- Leave the range set to All Ranges. The range setting can be used to export only a fenced area or specific view.

-Toggle the bottom Point group option, and select our feature (EXPORT_POINT) from the drop-down selector.

 

Figure 20

- Click Export, and GeoGraphics creates the shapefiles. Confirmation of export success will be displayed at the bottom of the program window within MicroStation's Message Center. If you want to view the message history, double-click the message area to expand it.

 

Figure 21

Follow the same strategy for the remaining features. See figures 22, 23, and 24 for settings. Be sure to rename the export file for each export operation.

 

Figure 22

 

Figure 23

 

Figure 24

Note that for the EXPORT_SHAPE feature, toggle the Area group and select EXPORT_SHAPE for the topmost selection. The bottom selection of the group will remain set to any point feature found, but this is ignored unless combined with the selection of an area boundary feature for the topmost selection.

Viewing resulting data

Graphics

Results can be re-imported into MicroStation to confirm that the desired results were obtained, or can be viewed using ESRI's free ArcExplorer download (http://www.esri.com/software/arcexplorer/index.html) .

(The following figures are from ArcMap.)

 

Figure 25

Attribute data

Since the ESRI shapefile format requires each element to have an attribute linkage, we see that the elements' feature linkage information is used for the attribute record exported to the *.dbf file component of the shapefile. (See figure 26.)

 

Figure 26

Of course, users with existing data containing attribute linkages will know that MicroStation itself can have multiple database linkages from multiple tables on each element. Discussing table creation and linking of attribute information is beyond the scope of this article; however, interested readers can look to the following sections of the MicroStation and GeoGraphics help for additional reading:

(Help->Contents...)

Administrator Guide -> External Database Interface...

(Help-> GeoGraphics Contents...)

User Guide -> Using MicroStation GeoGraphics -> Visual Query Builder...

When exporting elements with attribute linkages, users will need to define the table as the Associated Attribute Table within the feature definition, prior to export. Refer to the Feature Setup dialog box figures above for the location of this setting. For additional options see:

(Help-> GeoGraphics Contents...)

Administrator Guide -> Import/Export Modules -> Non-Graphics Database Attributes...

See Also

Client Server Archive

Geospatial Product TechNotes And FAQs

MicroStation Desktop TechNotes and FAQs

Comments or Corrections?

Bentley's Technical Support Group requests that you please confine any comments you have on this Wiki entry to this "Comments or Corrections?" section. THANK YOU!