Writer Directives

The directives that are processed by the GRD writer are listed below. The suffixes shown are prefixed by the current <WriterKeyword>_ in a mapping file. By default, the <WriterKeyword> for the GRD writer is GRD.

DATASET

The value for this keyword is the file containing the GRD dataset to write.

Required/Optional

Required

Mapping File Syntax

GRD_DATASET /usr/data/PenMetrics/output.grd

Workbench Parameter

Destination PenMetrics GRD File(s)

DEF

Required/Optional: Optional if AUTO_CREATE_LAYERS is used

The GRD writer requires that every feature written to the GRD file is stored within a predefined GRD layer. In GRD, the layers are used to store collections of logically related attributes. Within the FME, the GRD layer and the type of feature are treated synonymously as there is a one-to-one correspondence between FME feature type and GRD layer.1Layers can also be defined through the use of a TEMPLATE_FILE. The layer statement has the following form:

<WriterKeyword>_DEF  <layer name> \
	[grd_layer_type <layer type>] \
	[grd_is_fixed <boolean>] \
	[grd_is_visible <boolean>] \
	[grd_pen_color <default color>]	\
	[grd_brush_color <default color>] \
	[grd_pen_width <default width>]	\
	[grd_pen_width_type <default width type>] \
	[grd_brush_type <default brush type>] \
	[grd_linetype <default linetype>] \
	[<attribute name> <attribute type>]

where:

  • <layer name> is the name of the layer being defined and is used throughout the remainder of the FME mapping files.
  • <layer type> is the type of layer being defined. The default is DRAWING. The values are associated with the following types:
    • 0 = MARKUP
    • 1 = DRAWING
  • <boolean> is either True or False. By default, layers are visible and not fixed.
  • <default color> is the color number used for all features stored within the layer unless explicitly overridden on the correlation lines below. Valid values are between 0 and 18. Refer to the discussion under the heading Colors for the color description. By default, color = 0 (black).
  • <default pen width> is the actual width of the pen. This expects a numeric value and is interpreted differently depending on the pen width type. The default is 1.
  • <default pen width type> is the pen width type used for all features stored within the layer unless explicitly overridden on the correlation lines below. The default value is 1 (Hairline). The values are associated with the following types:
    • 1 = HAIRLINE
    • 2 = VIRTUAL
    • 3 = PIXEL
  • <default brush type>: is the numeric brush type used for all features stored within the layer unless explicitly overridden on the correlation lines below. The default is 0 (Solid). The values are associated with the following types:
    • 0 = SOLID
    • 1 = DIAGONAL #1
    • 2 = CROSS
    • 3 = DIAGONAL COORD
    • 4 = DIAGONAL #2
    • 5 = HORIZONTAL
    • 6 = VERTICAL
  • <default linetype> is the name of the linetype used for the layer if no linetype is specified on the correlation line. The default value is CONTINUOUS. The linetype specified must be:
    • defined in the mapping file,
    • copied from a specified template file, or
    • be the predefined linetype named CONTINUOUS
  • <attribute name> <attribute type> is the definition of an attribute to be stored within the extra entity data of features for the layer. If no attributes are defined, then all feature attributes except those that start with grd_ are stored. The storing of attributes can be turned off by specifying an attribute type of SKIP.

The example below defines a layer called boundary in which entities are drawn using pen color 13 unless otherwise specified, and a linetype called dash-dot unless otherwise specified, etc. The feature also has several specified attributes that are written to the extra entity data of each feature within the layer.

GRD_DEF boundary \
	grd_pen_color 13 \
	grd_brush_color 4 \
	grd_brush_type 2 \
	grd_pen_width_type 3 \
	grd_linetype dash-dot \
		FEATCODE        char(12)			
		PPID            char(10) \
		DATECHNG        date \
		SURVEYDIST      number(8,2)

TEMPLATE_FILE

This setting gives the name of the file or files used as templates.

All layer styles, line styles, and block definitions are taken directly from the template files and used in the output GRD file that the FME produces. Multiple template file names may be listed after the keyword on a single line, or multiple template file names may be listed on separate lines, each beginning with the TEMPLATE_FILE directive. New layers can be defined during the translation using the DEF lines and added to those brought in from the template files. If there are duplicate definitions for the same layer, the DEF line definitions prevail.

Note: Tip: LINETYPE definitions found in the mapping file override any linetype definitions found in the template file.

Required/Optional

Optional

Mapping File Syntax

GRD_TEMPLATE_FILE /usr/data/penmetrics/map.grd

AUTO_CREATE_LAYERS

Required/Optional: Optional

This statement tells the writer to create layers as needed. Normally, all layers must either be defined by _DEF lines or the template file before they can be used. If AUTO_CREATE_LAYERS is specified as yes, and a feature with a feature type not previously defined as a layer is sent to the writer, then a new layer will be created. This layer is created with the properties of the last _DEF line found in the mapping file, if any, or it uses other defaults.

This example sets the writer into a mode where it creates layers as needed. Each created layer has a color of 4 (red) and a linetype of CONTINUOUS.

GRD_AUTO_CREATE_LAYERS yes
GRD_DEF_DEFAULT \
	grd_color	10 \
grd_linetype CONTINUOUS

LINETYPE

Required/Optional: Optional

The GRD writer enables linetypes to be defined within the FME mapping file. This lets the user control how output lines look in the destination dataset. The linetype definition takes the following form:

<WriterKeyword>_LINETYPE <linetype name> \
	[grd_linetype_description <picture>] \
	[grd_dash_type <dash type>] \
	[<segment values>+]

where:

  • <linetype name> is the name used throughout the mapping file to refer to the linetype being defined by this statement. If this is not set, “” (By Layer) is used.
  • <picture> is the text or name displayed in FieldNotes when linetypes are displayed. If this is not set, “” is used.
  • <dash type> can have the value 0 or 1, where 0=PIXEL and 1=VIRTUAL. This indicates whether the dash lengths are in real world coordinates or if they represent a length in screen pixels. Virtual linetypes spread out when you zoom in on them. Pixel linetypes are the same no matter what scale you are at. If this is not set, 0 (PIXEL) is used.
  • <segment values> are the length of each of the segments within the linetype segment. There is a maximum of 12 segments to each linetype. If no segment values are set then by default none are used. The segment values obey the following rules:
    • negative value — pen up length, used to create spaces of varying lengths
    • positive value — pen down length, used to make dashes of varying lengths
    • zero — used to create a dot

The following example creates a linetype called dash-dot which appears as
“ __ . __ . __ . ” and so on when displayed on the screen.

GRD_LINETYPE dash-dot \
	grd_linetype_description “ __  .  __  .  __  . ” \
	grd_dash_type 0	\
	2.5 -2.25 0 -2.25