A.2 Marker Styles

A marker style represents a marker to be placed on point features or on label points of area and linear features.

A marker can be either a vector marker or raster image marker. A marker can also have optional notational text. For a vector marker, the coordinates of the vector elements must be defined in its XML document. For a marker based on a raster image, the XML document for the style indicates that the style is based on an external image.

The marker XML document specifies the preferred display size: the preferred width and height are defined by the width:value;height:value pairs in the style attribute of the <g> element. The class attribute must be set to "marker". Some markers must be overlaid with some notational text, such as a U.S. interstate highway shield marker, which, when rendered, must also have a route number plotted on top of it. The style for such notational text is a style attribute with one or more of the following name-value pairs: font-family:value, font-style:value, font-size:value, and font-weight:value.

The following example defines an image-based marker that specifies font attributes (shown in bold) for any label text that may be drawn on top of the marker:

<?xml version="1.0" standalone="yes"?>
<svg width="1in" height="1in">
<desc></desc>
<g class="marker"           
  style="width:20;height:18;font-family:sans-serif;font-size:9pt;fill:#ffffff">
    <image x="0" y="0" width="9999" height="9999" type="gif" 
           href="dummy.gif"/>
</g>
</svg>

In the preceding example, when the marker is applied to a point feature with a labeling text, the label text is drawn centered on top of the marker, using the specified font family and size, and with the fill color (white in this case) as the text foreground. The label text (495) in Figure A-1 in Using Marker Styles on Lines has the text attributes specified in this example.

A.2.1 Vector Marker Styles

A vector marker can be a simple polygon, an optimized rectangle (defined using two points), a single polyline, or a circle, but not any combination of them. For each type of vector marker, its <g> element must contain a corresponding subelement that specifies the geometric information (coordinates for the polygon, optimized rectangle, or polyline, or radius for the circle):

  • A polygon definition uses a <polygon> element with a points attribute that specifies a list of comma-delimited coordinates. For example:

    <g class="marker">
       <polygon points="100,20,40,50,60,80,100,20"/>
    </g>
    
  • An optimized rectangle definition uses a <rect> element with a points attribute that specifies a list of comma-delimited coordinates. For example:

    <g class="marker">
      <rect points="0,0, 120,120"/>
    </g>
    
  • A polyline definition uses a <polyline> element with a points attribute that specifies a list of comma-delimited coordinates. For example:

    <g class="marker">
       <polyline points="100,20,40,50,60,80"/>
    </g>
    
  • A circle definition uses a <circle> element with an r attribute that specifies the radius of the circle. For example:

    <g class="marker">
       <circle r="50"/>
    </g>
    

You can specify a stroke or fill color, or both, for any vector-based marker. The syntax is the same as for the style attribute for a color style. The following example defines a triangle marker that has a black border and that is filled with a half-transparent yellow:

<?xml version="1.0" standalone="yes"?>
<svg width="1in" height="1in">
<g class="marker"  style="stroke:#000000;fill:#ffff00;fill-opacity:128">
     <polygon points="201.0,200.0, 0.0,200.0, 101.0,0.0"/>
</g>
</svg>

If a marker is scalable, you can set the marker's maximum size in pixels on a map by using the max_size_in_px attribute. Setting this attribute to an appropriate value will prevent the marker from getting so large as to block other map features when the user zooms in to view fine map details. The following example sets the marker's maximum size to 64 pixels:

<?xml version="1.0" standalone="yes"?>
<svg width="1in" height="1in">
    <g class="marker" max_size_in_px="64" style="stroke:#0000BB;fill:#0033FF;width:3.0mile;height:3.0mile;font-family:Dialog;font-size:12;font-fill:#FF0000">
        <polygon points="0.0,0.0,0.0,100.0,100.0,100.0,100.0,0.0,0.0,0.0"/>
    </g>
</svg>

A.2.2 Image Marker Styles

For an image marker, its XML document contains an <image> element that identifies the marker as based on an image. The image must be in GIF format, and is stored in the IMAGE column in the styles metadata views.

The following example is an XML document for an image marker:

<?xml version="1.0" standalone="yes"?>
<svg>
   <g class="marker"
             style="width:20;height:18;font-family:sansserif;font-size:9pt">
     <image x="0" y="0" width="9999" height="9999" type="gif" href="dummy.gif"/>
   </g>
</svg>

Note that in the preceding example, it would be acceptable to leave the <image> element empty (that is, <image/>) to create a valid definition with the image to be specified later.

A.2.3 TrueType Font-Based Marker Styles

For a TrueType font-based marker, its marker symbol is stored in a TrueType font file, which has the .ttf file extension and which typically contains many individual symbols or glyphs. Many GIS software packages come with TrueType font files that contain symbols useful for mapping.

Before the map visualization component can use a symbol in a TrueType font file, you must do the following:

  1. Import the TrueType font file into the database, preferably by using the Map Builder tool (described in Oracle Map Builder Tool), which causes the symbols in the font file to be inserted into a single row in the system view USER_SDO_STYLES. In this new row, the TYPE column contains the string TTF, and the IMAGE column contains the contents of the TrueType font file. After the import operation, you can use the Map Builder tool to view all the glyphs or symbols contained inside the TrueType font file. Also, because the font file is now physically stored inside a database, it can be shared by all the map visualization component users.

  2. Create a map visualization component marker style based on a glyph or symbol inside an imported TrueType font, preferably using the Map Builder tool.

The following example shows the use of a TrueType font-based marker (with TrueType-specific material in bold):

<?xml version="1.0" standalone="yes"?>
<svg width="1in" height="1in">
<g class="marker"  style="fill:#ff0000;width:25;height:25">
  <ttfSymbol fontName="ERS_INCIDENTS" charCode="118" />
</g>
</svg>

A.2.4 Using Marker Styles on Lines

Marker styles are usually applied to point features, in which case the marker style is rendered on the point location that represents the feature. However, with line (line string) features such as highways, the marker must be placed at some point along the line to denote some information about the feature, such as its route number. For example, on maps in the United States, a shield symbol is often placed on top of a highway, with a route number inside the symbol, as shown with Route 495 in Figure A-1.

Figure A-1 Shield Symbol Marker for a Highway

Description of Figure A-1 follows
Description of "Figure A-1 Shield Symbol Marker for a Highway"

To achieve the result shown in Figure A-1, you must do the following:

  1. Choose a marker style, and add a text style definition (font family, font size, fill color, and so on), as shown in the example in Marker Styles.

  2. Specify the marker style as the labeling style in the styling rules for the theme. The following example shows the XML document with the styling rules for a theme to show highways. A marker style (shown in bold in the example) is specified. The label text (495 in Figure A-1) is a value from the label column, which is named LABEL in this example.

    <?xml version="1.0" standalone="yes"?>
    <styling_rules theme_type="political">
    <rule>
       <features style="L.PH"> (name_class = 'I' and TOLL=0) </features>
       <label column="label" style="M.SHIELD1">1</label>
    </rule>
    <styling_rules>
    

The map visualization component automatically determines the optimal position on the line for placement of the marker style (the shield in this example).