Writing Microstation (DGN) Tags with FME

Pierre  Koelich
Pierre Koelich
  • Updated

Introduction

Non-spatial attribute information can be attached to a DGN element as tags, a Microstation feature. A simple parameter inside FME can help to write FME attributes as MicroStation tags. Tags can be written to MicroStation design files by creating a series of format attributes that define tags and tag sets, as well as user attributes that store tag values.

Reading MicroStation tags using FME is covered in this article.

 

Writing Tags: A Basic Example

1. Add MapInfo TAB (MITAB) Reader

Start FME Workbench. On the Start Page, select New Workspace to create a blank canvas.

Add a Reader to the workspace (from the Readers menu select Add Reader).

  • Format: MapInfo TAB (MITAB)
  • Dataset: Parks.tab

 

2. Add DGN Writer

Add a Writer to the workspace (from the Writers menu select Add Writer).

  • Format: Bentley MicroStation Design (V8)
  • Dataset: Written Tag.dgn in a file location of your choosing.
  • Level Definition: Automatic

Click on Parameters

 

When adding a DGN writer to a workspace, the parameters dialog has a Write tags parameter with the option of Yes or No.

Set the Write Tags parameter to Yes, then click OK.

 

Click OK, this will open the Feature Type dialog box, set the Level Name to Parks and click OK

 

The same parameter exists in the Navigator window in an existing workspace:

 

3. Run Workspace

Run the workspace.

 

When the Write Tags parameter is set to yes ,when the workspace is run, the attribute information from the source features will be written as a set of tags to the MicroStation dataset:

results-microstation-tags.png

 

The tagset here is named "Parks" because that is the name of the FME feature type.

 

Writing Tags Through Attributes

When more than one tagset is required, then tags can be defined using format attributes. These attributes tell the writer which attributes should be used and to which tag set they should belong. The attributes are as follows:

igds_tag_names{}
<tag name>.tagset_name
<tag name>.tagtype
<tag name>.prompt
<tag name>.display
<tag name>.default_value
<tag name>.x_offset
<tag name>.y_offset
<tag name>.z_offset


For example, you might define attributes as:

igds_tag_names{0} = ParkName
igds_tag_names{1} = ParkArea
ParkName.tagset_name = Leisure
ParkArea.tagset_name = GroundsMaintenance

This would create two tagsets (Leisure, GroundsMaintenance), each with a single tag (ParkName, ParkArea)

 For more information on tags, see the documentation.

 

Writing Tags: An Advanced Example

The following example writes a set of parcel boundaries with two different tagsets: one for general parcel information, one for ownership information. 

The first part of this workspace will read parcel data, containing parcel information, and combine it with ownership data from an Excel spreadsheet. 

The second part will generate the attributes that will define the tags, and then write the output to a Microstation DGN file.

 

1. Add MapInfo Reader

In a blank workspace, add a reader to the canvas. 

  • Format: MapInfo TAB (MITAB)
  • Dataset: parcels.tab

 

2. Add an Excel Reader

Add another reader to the workspace.

  • Format: Microsoft Excel
  • Dataset: Parcels.xls

 

Choose the parcelOwners Feature type when prompted.

 

3. Add a FeatureMerger

Add a FeatureMerger transformer to the canvas. This will merge the two datasets based on a common attribute, in this case, PARCEL_ID.

Connect the parcels reader feature type to the Requestor port.

Connect the parcelOwners reader feature type to Supplier port.

Open the FeatureMerger parameters, set the Requestor to read the PARCEL_ID from parcels, and set the Supplier to read the PARCEL_ID from parcelOwners.

 

4. Add an AttributeCreator

Add an AttributeCreator to the canvas. Connect the Merged port of the FeatureMerger to the AttributeCreator.

Create each of the following attributes.

We set up a list of attributes we would like to see in the design file, which equates to the tags being created:

Attribute Value
igds_tag_names{0} PARCEL_ID
igds_tag_names{1} AREA
igds_tag_names{2} PERIMETER
igds_tag_names{3} Owner
igds_tag_names{4} OwnershipSince

 

We also assign each tag to a tagset, which allows us to create more than one tag set:

Attribute Value
Parcel_ID.tagset_name ParcelData
AREA.tagset_name ParcelData
PERIMETER.tagset_name ParcelData
Owner.tagset_name OwnerData
OwnershipSince.tagset_name OwnerData

 

We define the tag data types (where 1 is a string, 3 is an integer, and 4 is a real number):

Attribute Value
PARCEL_ID.tagtype 3
AREA.tagtype 4
PERIMETER.tagtype 4
Owner.tagtype 1
Ownershipsince 3

 

For PARCEL_ID, we also create a set of optional attributes, which control whether the tag is displayable and how it is placed relative to the feature origin:

Attribute Value
PARCEL_ID.display Yes
PARCEL_ID.height 5
PARCEL_ID.justification 7

 

The AttributeCreator parameters should look like this.

 

5. Add a CenterPointExtractor

Add a CenterPointExtractor to the canvas and connect it to the AttributeCreator. This transformer retrieves the x, y, and z coordinates of the center point of the parcel's bounding box.

Set the Point Extraction Mode to Any Inside Point.

 

6. Add a CoordinateExtractor

Add a CoordinateExtractor to the canvas and connect it to the CenterPointExtractor.

Open the CoordinateExtractor parameters. Set the Mode to Specify Coordinate and set the Default Z Value to -9999. In this case, we do not need to worry about the z coordinate as we are using 2D data.

 

7. Calculate the x Offset using an ExpressionEvaluator

When <tag_name>.display is set to 'yes' we also have to set offset attributes to define where that tag will be displayed.

Add an ExpressionEvaluator to the canvas and connect it to the CoordinateExtractor.

Set New Attribute to PARCEL_ID.x_offset.

Use the following Arithmetic Expression.

@Value(_inside_x)-@Value(_x)

 

8. Calculate the y Offset using an ExpressionEvaluator

We are going to repeat the previous step this time, calculating the PARCEL_ID y offset.

Add another ExpressionEvaluator to the canvas and connect it to the first ExpressionEvaluator.

Set New Attribute to PARCEL_ID.y_offset.

Use the following Arithmetic Expression.

@Value(_inside_y)-@Value(_y)

 

9. Add a DGN Writer

Finally, add a Bentley MicroStation Design (V8) writer to the canvas. Choose a location for the output data. Click on Parameters.

 

Set Write tags to Yes and ensure that the Seed File (V8 only) is set to read the seed2d_m_v8.dgn. Click Ok.

 

10. Run the Workspace

Run the workspace and view the results in Microstation. 

 

The result is a set of tags in MicroStation:

10-results.png

There is a completed workspace called writingdgntags.fmwt attached to the document with bookmarks and annotations.

 

Data Attribution

This article contains open data made available by the City of Vancouver, British Columbia. This article contains data licensed under the Open Government License - Vancouver.

Was this article helpful?

We're sorry to hear that.

Please tell us why.

As of January 14th, 2026, comments on knowledge base articles have been closed. To make sure questions don’t get missed and to enable more community support, we’ve moved discussions to the FME Community. If you have a question or a comment about this article, please create a new post or create a support ticket.