Hexagon Geospatial
MENU

Developers Knowledge Base

Mobile and field solutions function as an extension of the overall enterprise, and include the ability to access, create, review and update geospatial data and asset information in real-time in the field.
Showing results for 
Search instead for 
Do you mean 

Configuring vector styles

by Technical Evangelist on ‎01-13-2016 08:09 AM - edited on ‎02-03-2016 02:15 AM by Technical Evangelist (1,140 Views)

There are multiple options of configuring vector data styles in MMW. In this article you'll find:

  • Style configurations concepts explanation
  • Style configuration samples

 

General configuration file structure is describe in 'Configuration file structure' article.

 

Style configuration concepts

A legend entry has a style assigned. In case of styling vector data a "vector" property is used.

 

"legends":[
    {
        "id":"dbbf386a-88a1-490c-b48d-3bc00383ea26",
        "name":"Demo",
        "entries":[
            {
                "id":"3be29122-93ea-47a9-bcf3-4532ad1599d0",
                "dataset":"24280e25-7cdc-47f7-b567-72609e096860",
                "visible":true,
                "style":{
                    "vector":{...}
}
}
]
}
]

 

Vector style has two properties: primary and selection.

  • Primary is a style of a displayed feature
  • Selection is a style of a selected feature

 

"vector":{
    "primary":{...},
    "selection":{...}
} 

 

A vector style can be a static or an attribute based style.

  • Static style is a simple style that is assigned to all features. 

 

"style":{
    "vector":{
        "primary":{
            "radius":8,
            "fill":{
                "color":"#FF0000",
                "opacity":0.7
            },
            "stroke":{
                "color":"#FFFF00",
                "width":2,
                "opacity":1
            }
}, "selection":{ ...}
}
}

 

  • Attribute based style is a collection of attribute filter and static style pairs. The style is applied based on feature attributes.

 

"vector":{
    "primary":{
        "entries":[
            {
                "filter":{
                    "id":"filter",
                    "operator":"propertyIsEqualTo",
                    "operands":[
                        {
                            "operator":"valueReference",
                            "value":"Type"
                        },
                        {
                            "operator":"literal",
                            "value":"Walker"
                        }
                    ]
                },
                "style":{
                    "radius":8,
                    "fill":{
                        "color":"#FF0000",
                        "opacity":0.7
                    },
                    "stroke":{
                        "color":"#FFFF00",
                        "width":2,
                        "opacity":1
                    }
                }
            }
        ]
    },
    "selection":{...}
}

 

Attribute style application strategy

  • If a feature does not match a filter, default style is used
  • If a feature matches a filter, then a style is applied. If the style does not have all the style attributes, then missing attributes values will be taken from the default style attributes.
  • If a feature matches several filters, style attributes will be merged. The priority (from the low priority) is as follows: default style, entry[0], entry[1]. All the style attributes from  entry[1] will be applied. Only the style attributes that are not present in entry[1] and are present in entry[0] will be applied. Only the style attributes that are not present in entry[0], entry[1] and are present in default style will be applied. !!! The current merging strategy causes performance hit. It may be changed in the near future !!!

Style Configuration Samples

Sample Configuration files can be here.

 

    • Simple style:

A simple vector style that is applied for all features from class.

   primary style  selection style
 all features  style  style_ss.png
    • Attribute based style with a simple filter:

A style contains a filter that is made with "propertyIsEqualTo" operator. A style is applied only for a features that satisfy a filter condition. The same filter are used for a selection style.

  primary style  selection style
features with Type="Walker" style style
other features (default style) style style_sfsd.png
    • Attribute based style with a complex filter:

A style contains a filter that is made with "and", "propertyIsEqualTo" and "propertyIsGreaterThan" operators. A style is applied only for a features that satisfy the filter condition. The same filter are used for a selection style.

  primary style  selection style
features with Type="Walker" and Direction="90" style style_sc.png
other features (default style) style style_sfsd.png
    • Complex attribute based style:

Style contains two filters. A style is applied only for a features that satisfy at least one filter condition. The same filters are used for a selection style.

  primary style  selection style
features with Type="Walker" style style
features with Type="Walker" and Direction="90" style style_cw9s.png
other features (default style) style style_sfsd.png
Overview