Using the Renderer Editor

Use the Renderer Editor to set layer and metadata filters that define the map features that a Renderer node renders.

You can also use the Renderer Editor to edit the filters of the Tile Data Source by accessing it through the Prefab Feature Renderer. To learn how to use the Prefab Feature Renderer, Tile Data Source, and Renderer Editor to add points of interest and street labels to a map, complete the Tutorial: Points of interest and labels.

Using a preset filter

The Renderer Editor provides presets that automatically set the layer and metadata filters to values required to set a Renderer node to render specific type of map content.

To use a preset filter:

  1. In the Node Tree, select the Renderer node whose filter you want to set.

    For example, select a Stroke Renderer node that you want to use to render roads.

    ../../_images/stroke-renderer-node.png
  2. In the Kanzi Studio main menu, select Kanzi Maps > Renderer Editor.

    ../../_images/kanzi-maps-renderer-editor-menu.png
  3. In the Renderer Editor, set the Preset to the map feature that you want to render.

    For example, set it to Major roads.

    ../../_images/renderer-editor-select-major-roads-preset.png

    The preset automatically updates the Metadata filter to show an editable visual presentation of the filter and in the Stroke Renderer node, sets:

    • Stroke Layer Filter to roads

    • Stroke Metadata Filter to

      class == {motorway, primary, secondary, tertiary, trunk} && structure == {ford, none, bridge}
      
    ../../_images/renderer-editor-major-roads-filter1.png ../../_images/properties-stroke-renderer-filters.png

Using the Renderer Editor to define a metadata filter

A metadata filter consists of a tree of rules. The tree visualizes a metadata filter expression that determines which map features a Renderer node renders. When the entire metadata filter expression matches a map feature, the Renderer node renders that feature. Kanzi Maps evaluates a metadata filter expression by considering all rules in that expression, starting from the outermost rule.

These tables list the operations that you can use in a metadata filter.

Logical operations

This table lists the logical operations that you can use in a metadata filter.

all match

&&

All rules within this operation match. Can have as its child any rule, except an arithmetic operation.

at least one matches

||

At least one rule within this operation matches. Can have any rule as its child.

Set rules

This table lists the set rules that you can use in a metadata filter.

is one of

==

Metadata value associated with the metadata key is one of the values listed as children.

is none of

!=

Metadata value associated with the metadata key is none of the values listed as children.

Comparison rules

This table lists the comparison rules that you can use in a metadata filter.

A comparison rule cannot have child rules.

is

==

The value associated with the metadata key is the same as right-hand-side value.

is not

!=

The value associated with the metadata key is different from the right-hand-side value.

is greater than

>

The value associated with the metadata key is greater than the right-hand-side value.

is greater or equal to

>=

The value associated with the metadata key is greater than or equal to the right-hand-side value.

is less than

<

The value associated with the metadata key is less than the right-hand-side value.

is less or equal to

<=

The value associated with the metadata key is less than or equal to the right-hand-side value.

Arithmetic operations

This table lists the arithmetic operations that you can use in a metadata filter.

An arithmetic operation cannot have child rules.

%

%

Calculates the modulo that is the remainder when one number is divided by another.

Defining a metadata filter

To define a metadata filter:

  1. In the Node Tree, select a Renderer node whose metadata filter you want to set.

    For example, create a Stroke Renderer node that you want to use to render major roads.

    ../../_images/major-roads-node2.png
  2. In the Kanzi Studio main menu, select Kanzi Maps > Renderer Editor.

    ../../_images/kanzi-maps-renderer-editor-menu.png
  3. In the Renderer Editor, set the Layer to the name of the layer from which you want to get the map features to render.

    For example, if you use Mapbox and want to render roads, set the Layer to road. The road layer contains the geometry for features such as roads, railways, paths, and their labels. See Supported backends.

    ../../_images/renderer-editor-set-layer.png
  4. To add a rule or item, hover over an existing rule, click renderer-add-filter, and select a rule.

    For example, select the is one of set rule.

    ../../_images/renderer-editor-add-rule.png ../../_images/major-roads-is-one-of.png
  5. Click the left-hand metadata key and set it to a value.

    For example, click bike_lane and set it to class.

    ../../_images/major-roads-select-class.png
  6. Next to the rule that you added, click renderer-add-filter to add a value.

    For example, add motorway.

    ../../_images/class-is-one-of-new-value.png ../../_images/class-is-one-of-motorway.png

    Tip

    In the metadata filter editor, hover over an item in the field menu to see its description generated from the Mapbox documentation.

    ../../_images/class-documentation-tooltip.png

    The Stroke Renderer node now renders only high-speed grade-separated highways.

    ../../_images/motorways-preview.png
  7. Repeat the previous step to add more values.

    For example, in the class is one of rule, add these fields:

    • primary to render major highways that link large towns.

    • secondary to render highways that link large towns.

    • tertiary to render roads that link small settlements, or the local centers of a large town or city.

    • trunk to render important roads that are not motorways.

    Tip

    To edit the metadata filter, use these keyboard shortcuts:

    Action

    Shortcut

    Move the keyboard focus in the list of rules and values.

    (Up Arrow) and (Down Arrow) keys

    Add a value after the selected value.

    Tab key

    Copy the selected rule or value.

    Ctrl C keys

    Cut the selected rule or value.

    Ctrl X keys

    Paste the selected rule or value.

    Ctrl V keys

    Remove the selected rule or value.

    Delete key

    ../../_images/class-is-one-of-primary.png ../../_images/major-roads-metadata-filter.png

    Kanzi Studio sets in the Stroke Renderer node the Stroke Metadata Filter property to the expression that matches the filter that you created in the Renderer Editor:

    class == {motorway, primary, secondary, tertiary, trunk}
    

    The Stroke Renderer node now renders all major roads.

    ../../_images/all-major-roads-preview.png
  8. Add a comparison rule:

    1. Next to all match, click renderer-add-filter and select a comparison rule.

      For example, select the is not rule.

      ../../_images/renderer-editor-add-is-not-rule.png
    2. Set the key and value.

      For example, set the key to structure and the value to tunnel.

      ../../_images/structure-is-not-tunnel.png

    Kanzi Studio updates in the Stroke Renderer node the Stroke Metadata Filter property to:

    class == {motorway, primary, secondary, tertiary, trunk} && structure != tunnel
    

    The map now shows all major roads, except for the ones in tunnels.

    ../../_images/major-roads-without-tunnels-preview.png

Creating a preset filter

To create a preset filter:

  1. Define your metadata filter. See Using the Renderer Editor to define a metadata filter.

  2. In the Renderer Editor next to the Preset dropdown, click New.

    ../../_images/new-preset.png
  3. Name your preset and click Save.

    ../../_images/create-preset.png
  4. To remove a preset that you created, in the Preset dropdown next to that preset, click remove-preset-filter.

    ../../_images/remove-custom-preset.png

See also

Renderer nodes

Tutorial: Points of interest and labels

Using the Tile Data Source