<g> Element

Layer Definition

The <g> element is a child of <svg> element, it contains settings of topobase layers. The first <g> element is an element of root topobase layer. This element must have the attribute fs:ItemType="Layer". A root layer must include child layers. Child layers are also determined by the <g> element with the attribute fs:ItemType=”Layer”. A child layer must contain either additional child layers or shapes.

NOTE. It is forbidden to specify both child layers and shapes in the same layer.

All layers and shapes must have the id attribute as well as the style attributes containing the following fields: stroke, stroke-width, fill, and other attributes determined with SVG format specification of the version 1.1. By default, the following values are used for the fields: stroke=#000000, stroke-width=0, fill=#000000.

NOTE. On converting a topobase from SVG into TBS format any attributes except for id and style containing the fields stroke, stroke-width and fill, will be ignored.

IMPORTANT. On linking a topobase, all values in reports are shown in the shapes of the layer that has the Regions identifier. The layers with other identifiers will be rendered but will not be used in report work.

Linear Elements

To determine linear elements, <g> elements with the fs:ItemLayer="LinearLayer" attribute can be placed to the root layer. Such layers may include, for example, controversial national borders. Such an arrangement of linear elements ensures that topobases are correctly converted into other formats.

Shapes may be the elements of a linear layer (the list of primitives that are used to create shapes is shown below).

NOTE. On converting topobases into 3D format, linear layers are not converted and transferred in the same format. Foresight Analytics Platform uses linear elements in topobases, which are displayed on mobile devices.

Shapes Definition

A shape is determined by the <g> element with the fs:ItemType=”Item” attribute or without the fs:ItemType attribute. Only the primitives listed below may be used as shape children elements.

Primitives and shapes must not be placed at the same level. A shape must represent a geographical unit: region, district, county, city, sea, lake, and so on. Fill color, border color, width and style can be defined for a shape. A shape must consist of one or several primitives.

The following primitives can be used:

NOTE. In Foresight Analytics Platform only path primitives can be converted into TBS format.

Shape Identifiers

Each shape must have a string identifier. If the ISO attribute is determined for the topobase, shape identifiers and values of this attribute must match. Any string identifiers consisting of Latin letters, numbers and symbols "-" and "_" are supported. It is recommended to specify identifiers formed in accordance with the ISO 3166 standard.

NOTE. Shape identifier must not start with a number.

If the attribute ISO is missing, the identifier must have the following: "O<ID>", where <ID> is a shape digital identifier. In this case it is also recommended to set the IdMapping attribute, which values will be used to set parameters of topobase elements when converting into tbs.

IMPORTANT. Identifiers set in a different format are not supported when the topobase is converted.

Flags Attribute on Setting Up Child Layers

The <g> element corresponding to the child layer may contain the Flags optional attribute (for example, <g fs:ItemType="Layer" id="Regions" flags="0">). This attribute is taken into account on converting from svg into tbs and is processed in the following way:

Syntax

<g fs:ItemType="Layer" id="O0">

    <g id="Regions" fs:ItemType="Layer">

        <g id="RU-MOS" style="fill: #B0B0B0; stroke: #000000; stroke-width: 1;">

            <path d="M..." />

        </g>

        ...

    </g>

    ...

</g>

Element Attributes

Layer attributes:

Attribute Description
fs:ItemType="Layer" The attribute that indicates whether the current element corresponds to the topobase layer.
id Layer identifier.

Linear layer attributes:

Attribute Description
fs:ItemType="LinearLayer" Attribute indicating that the current element corresponds to the linear topobase layer.
id Layer identifier.

Shape attributes:

Attribute Description
id Shape identifier.

Other attributes that can be used for the <g> element are optional. Their syntax and description are available in the SVG format specification 1.1.

IMPORTANT. Names of all attributes must be written in lower-case letters.

See also:

SVG Topobase Structure