• JMap.Map.Filter.applyHasAttribute

    Render only layer's features that has the attribute defined in their properties. If the feature attribute is defined but its value is undefined, the feature will be rendered.

    Only one attribute filter can be set for a specific layer and attributeId at the same time.

    Parameters

    • layerId: JId

      The JMap layer id

    • attributeId: string

      The JMap attribute id

    Returns string

    The filter id. By example for layer 4 and attribute 'on_off' => "attribute-4-on_off"

    Throws

    Error if layer or attribute is not found

    Example

    // Will render only features having attribute "name" for layer 4
    JMap.Map.Filter.applyHasAttribute(4, "name")