CARIS HIPS and SIPS : Support Files Guide : Mapping : Annotation Mapping
 

Annotation Mapping

Feature attributes in an S-57 or HOB file can be inserted as annotations on a source usage. This is done using the CARIS Batch AddFeaturesAsAnnotations process. For more information on AddFeaturesAsAnnotations, see the CARIS Batch Guide.

The process reads feature identifiers from a HOB or S-57 file and adds annotations to matching features in an HPD usage. The annotations are generated from an annotation mapping file that sets what attributes can be used as annotations and how those annotations are displayed.

No annotation mapping files are in the release. All files must be built.

An example of a simple mapping file is shown below.

<?xml version="1.0" encoding="UTF-8" ?>

<ObjectToObjectConversionTable Version="1.0" FromType="GO" ToType="GO">

  <ConversionTableInfo Version="1.1" FromProduct="S-57" ToProduct="S-57 Name="Conversion For AddFeaturesAsAnnotations" CreationDate="20141210" CreatedBy="CARIS" Comment="File for AddFeaturesAsAnnotations.">

  </ConversionTableInfo>

  <ObjectMappings>

    <Object Acronym="LNDRGN">

    <Filter>

      <PrimitiveIsEqualTo Primitive="Point"/>

    </Filter>

    <MapObject>

      <ConvertGeometry Primitive="Text" Acronym="OBJNAM"/>

      <MapObjectAcronym Acronym="$lndrg"/>

      <SetPropertyValue Property="text/style/font" Value="Courier"/>

      <SetPropertyValue Property="text/style/size" Value="25"/>

      <SetPropertyValue Property="text/style/bold" Value="True"/>

      <SetPropertyValue Property="text/style/italic" Value="False"/>

      <SetPropertyValue Property="text/position/hjust" Value="Left"/>

      <SetPropertyValue Property="text/position/vjust" Value="Above"/>

      <SetPropertyValue Property="text/position/rotationReference" Value="PoleNorth"/>

    </MapObject>

     </Object>

  </ObjectMappings>

</ObjectToObjectConversionTable>

In this example, the OBJNAM attribute for the point feature LNDRGN is converted to the $lndrg (land region name) cartographic feature. The $lndrg feature can be included as an annotation on LNDRGN features using the properties described in the file.

The annotation is in 25 point, bold, Arial font.

The horizontal justification is left.

The vertical justification is above the feature.

The rotation reference is PoleNorth which means that the annotation’s orientation is set to north according to the coordinate reference system.

Attributes can also be set on a feature and used as annotations. See the following example.

<?xml version="1.0" encoding="UTF-8" ?>

<ObjectToObjectConversionTable Version="1.0" FromType="GO" ToType="GO"> <ConversionTableInfo Version="1.1" FromProduct="S-57" ToProduct="S-57" Name="Conversion For AddFeaturesAsAnnotations" CreationDate="20141210" CreatedBy="CARIS" Comment="File for AddFeaturesAsAnnotations.">

  </ConversionTableInfo>

  <GlobalAttributeMappings/>

  <AttributeMappings>

    <MapAttribute Name="SetVerticalTextPosition">

      <Entry>

        <Filter>

          <AttributeValueContains Acronym="INFORM" Value="Top" />

        </Filter>

          <SetPropertyValue Property="text/position/vjust" Value="Above" />

      </Entry>

      <Entry>

        <Filter>

          <AttributeValueContains Acronym="INFORM" Value="Centre" />

        </Filter>

        <SetPropertyValue Property="text/position/vjust" Value="Centre" />

      </Entry>

      <Entry>

        <Filter>

          <AttributeValueContains Acronym="INFORM" Value="Bottom" />

        </Filter>

        <SetPropertyValue Property="text/position/vjust" Value="Below" />

      </Entry>

    </MapAttribute>

    <MapAttribute Name="SetHorizontalTextPosition" >

      <Entry>

        <Filter>

          <AttributeValueContains Acronym="INFORM" Value="Left" />

        </Filter>

        <SetPropertyValue Property="text/position/hjust" Value="Left" />

      </Entry>

      <Entry>

        <Filter>

          <AttributeValueContains Acronym="INFORM" Value="Centre" />

        </Filter>

        <SetPropertyValue Property="text/position/hjust" Value="Centre" />

      </Entry>

      <Entry>

        <Filter>

          <AttributeValueContains Acronym="INFORM" Value="Right" />

        </Filter>

        <SetPropertyValue Property="text/position/hjust" Value="Right" />

      </Entry>

    </MapAttribute>

    <MapAttribute Name="SetBold">

      <Entry>

        <Filter>

          <AttributeHasValue Acronym="TXTDSC"/>

        </Filter>

        <CopyAttributeValue FromAcronym="TXTDSC" ToProperty="text/style/bold" />

      </Entry>

    </MapAttribute>

 

    <MapAttribute Name="SetTextOrientation">

      <Entry>

        <Filter>

          <AttributeValueContains Acronym="$style" Value="Grid" />

        </Filter>

        <SetPropertyValue Property="text/position/rotationReference" Value="GridNorth" />

      </Entry>

      <Entry>

        <Filter>

          <AttributeValueContains Acronym="$style" Value="North" />

        </Filter>

        <SetPropertyValue Property="text/position/rotationReference" Value="PoleNorth"/>

      </Entry>

      <Entry>

        <Filter>

          <AttributeValueContains Acronym="$style" Value="South" />

        </Filter>

        <SetPropertyValue Property="text/position/rotationReference" Value="PoleSouth" />

      </Entry>

    </MapAttribute>

  </AttributeMappings>

  <ObjectMappings>

    <Object Acronym="LNDRGN">

      <Filter>

        <PrimitiveIsEqualTo Primitive="Point"/>

      </Filter>

      <MapObject>

        <ConvertGeometry Primitive="Text" Acronym="OBJNAM"/>

        <MapObjectAcronym Acronym="$lndrg"/>

        <ApplyAttributeMapping Name="SetBold" />

        <ApplyAttributeMapping Name="SetVerticalTextPosition"/>

        <ApplyAttributeMapping Name="SetHorizontalTextPosition"/>

      </MapObject

  </ObjectMappings>

</ObjectToObjectConversionTable>

In this example, the OBJNAM attribute for the point feature LNDRGN is converted to $lndrg (land region name) cartographic feature. The $lndrg feature can be included as an annotation on LNDRGN features using the properties set through attributes.

For example, if the INFORM attribute contains the value Left and the TXTDSC contains a value. The horizontal justification property of the annotation (text/position/hjust) is set to left and value in TXTDSC is included with the annotation in bold text.

If a property is not set then the following defaults are used.

Property

Default Value

Font

Lucidia Console

Text Size

28 point (corresponds to 10mm on screen)

Bold

False

Italic

False

Horizontal Justification

Left

Vertical Justification

Baseline

Rotation Reference

Grid North

The following table describes the mapping functions that are required for mapping features and attributes as annotations.

Mapping Function

Attribute

Attribute Value

ConvertGeometry

Primitive="text"

This must be set to "Text". The attribute is converted to a text string that can be used as an annotation.

Note that the following mapping functions cannot be applied until this function is set.

CopyAttributeValue

FromAcronym="value"

The attribute value from where the text is be copied.

Property="path"

Paths determine text formatting, The following path values can be applied:

text/style/font - A text string with a name of the font.

text/style/size - A positive non-zero double value with the text size in points.

text/style/bold - "True" or "False" indicating if text should be bolded.

text/style/italic - "True" or "False" indicating if text should be italicized.

text/position/hjust - A text string indicating how the text is positioned horizontally. Valid hjust values are:

Left

Centre

Right

text/position/vjust - A text string indicating how the text is positioned vertically. Valid vjust values are:

Baseline

Font Upper

Font Lower

Above

Below

Centre

SetPropertyValue

Property="path"

Paths determine text formatting, The following path values can be applied:

text/style/font - A text string with a name of the font.

text/style/size - A positive non-zero double value with the text size in points.

text/style/bold - "True" or "False" indicating if text should be bolded.

text/style/italic - "True" or "False" indicating if text should be italicized.

text/position/hjust - A text string indicating how the text is positioned horizontally. Valid hjust values are:

Left

Centre

Right

text/position/vjust - A text string indicating how the text is positioned vertically. Valid vjust values are:

Baseline

Font Upper

Font Lower

Above

Below

Centre

text/position/rotationReference - A text string indicating the position of text in relation to the projection. There are three positions:

GridNorth

PoleNorth

PoleSouth

If

<Filter>

The <If> instruction allows for conditional annotation of text and symbols.

<If> works with the CreateAnnotation, SetAttribute, SetUnknownAttribute and SetUndefinedAttribute tags.

An <If> statement must enclose a <Filter>.

The <If> instruction can have more than one child instructions. It will concatenate the text of all its children into a single text.

Example for text:

<Object Acronym="LNDMRK">

  <CreateAnnotation Acronym="$text">

    <If>

      <Filter>

        <AttributeValueIsEqualTo Acronym="CATLMK" Value="2"/>

      </Filter>

      <Text>This only appears if CATLMK == 2.</Text>

    </If>

</Object>

Example for Symbol Annotation :

<CreateAnnotation Acronym="$CSYMB" Description="VEGATN Area Annotation Symbol" AnnotationType="SYMBOL" XOffset="0" YOffset="0">

<If>

<Filter>

<AttributeValueIsEqualTo Acronym="CATVEG" Value="7"/>

</Filter>

<SetAttribute Acronym="$SCODE" Value="Mangroves"/>

</If>

</CreateAnnotation>