Thursday, December 18, 2008

Create DGN Elements on Correct Levels with FME

By default, if you use the FME Workbench or the FME Universal Translator to create a DGN file, the geometries will be created as DGN graphic elements on level 1 and above incrementally for each feature type. For example as shown in the workbench figure below, the destination of my source feature is set to level 1, as indicated with the text "1" in the title bar.


Most times, users will want to control and define the output levels of the output DGN graphic elements since levels is a useful way to organize the graphical data e.g. level 1 for vegetation land use, level 2 for park land use, etc.

In this posting, I describe a way using FME mapping file to define and control the destination level. I am assuming that I have an attribute in the source feature that stores the level number.
  1. Use the FME Universal Translator to generate a mapping file from your source format e.g. ESRI Shape to the destination MicroStation Design format.



  2. Use a text editor to open up the resultant mapping file e.g. mapping.fme.

    The mapping file may look like this.

    # ============================================================================
    # Source feature type definition section
    # ============================================================================

    SHAPE_DEF LAND_USE \
    SHAPE_GEOMETRY shape_polygon \
    USE_TYPE char(50) \
    IGDS_LEVEL number(10,0) \
    ID number(10,0)

    # ============================================================================
    # Transformation section
    # ============================================================================

    SHAPE LAND_USE \
    USE_TYPE %USE_TYPE \
    ID %ID

    IGDS 1 \
    igds_type igds_solid \
    USE_TYPE %USE_TYPE \
    ID %ID


  3. In the Transformation section for the source format, add in the following line in bold.

    SHAPE LAND_USE \
    USE_TYPE %USE_TYPE \
    IGDS_LEVEL %IGDS_LEVEL \
    ID %ID


  4. In the Transformation section for the destination IGDS format, replace the number "1" with the text "level" and add in the following line in bold.

    Note:
    igds_level must be in lower case.

    IGDS level \
    igds_type igds_solid \
    USE_TYPE %USE_TYPE \
    igds_level %IGDS_LEVEL \
    ID %ID


  5. Save the changes and close the mapping file. Now when you run the translation, the DGN graphic elements will be created in the level defined in the IGDS_LEVEL attribute of the source feature.

No comments:

Post a Comment