<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 p5:ItemType="Layer". A root layer must include child layers. Child layers are also defined by <g> element with the attribute p5: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 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 define linear elements, <g> elements with the P5:ItemLayer="LinearLayer" attribute can be placed to the root layer. Such layers may include, for example, the controversial national borders. Such an arrangement of linear elements ensures that topobases correctly convert to other formats.

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

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

Shapes Definition

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

Primitives and shapes must not be placed in 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 Prognoz Platform 9, only path primitives can be converted to TBS format.

Shape Identifiers

Each shape must have a string identifier. If the ISO attribute is defined 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 from 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, values of which will be used to set parameters of topobase elements when converting to tbs.

IMPORTANT. Identifiers set in another 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 p5:ItemType="Layer" id="Regions" flags="0">). This attribute is taken into account on converting from svg to tbs and is processed in the following way:

Syntax

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

<g id="Regions" p5: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
p5:ItemType="Layer" The attribute that indicates whether the current element corresponds to the topobase layer.
id Layer identifier.

Linear layer attributes:

Attribute Description
p5:ItemType="LinearLayer" The attribute that indicates whether the current element corresponds to linear layer of topobase.
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 specification of SVG format of the version 1.1.

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

See also:

SVG Topobase Structure