s2maps-gpu - v0.18.0
    Preparing search index...

    Interface FillStyle

    Fill Style Guide

    A Fill layer guide defines how polygons should be colored, if they include patterns, are inverted, interactive, etc.

    [See LayerStyleBase]

    • name: the name of the layer, useful for sorting a layer on insert or for removal
    • source: the name of the source whose data this layer will use
    • layer: the source's layer. Defaults to "default" for JSON data
    • minzoom: the minimum zoom level at which the layer will be visible
    • maxzoom: the maximum zoom level at which the layer will be visible
    • filter: [See Filter] a filter function to filter out features from the source layer
    • lch: use LCH coloring instead of RGB. Useful for color changing when the new color is very different from the old one
    • visible: whether the layer is visible or not
    • metadata: additional metadata. Used by style generators
    • color: Color of the fill. Input either a string pull out the value using a Property.
    • opacity: the opacity of the fill. Choose between [0, 1], or pull out the value using a Property.
    • pattern: Draw a pattern on the fill given an input image. Input either a string pull out the value using a PropertyOnlyStep.
    • patternMovement: Boolean flag. If true, the pattern will move with the map rather than being static. Input either a boolean or pull out the value using a PropertyOnlyStep.
    • patternFamily: If left as the default, the pattern will be searched within any images added to the style. Otherwise use a sprite sheet. Input is either a string to the sprite sheet name, or pull out the value using a PropertyOnlyStep.
    • invert: if true, invert where the fill is drawn to on the map
    • interactive: boolean flag. If true, when hovering over the fill, the property data will be sent to the UI via an Event
    • cursor: [See Cursor] the cursor to use when hovering over the fill
    • opaque: if true, the fill will be drawn opaque and not allow transparency. Used for performance gains.
    interface FillStyle {
        color?: string | Property<string>;
        cursor?: string;
        filter?: Filter;
        interactive?: boolean;
        invert?: boolean;
        layer?: string;
        lch?: boolean;
        maxzoom?: number;
        metadata?: unknown;
        minzoom?: number;
        name?: string;
        opacity?: number | Property<number>;
        opaque?: boolean;
        pattern?: string | PropertyOnlyStep<string>;
        patternFamily?: string | PropertyOnlyStep<string>;
        patternMovement?: boolean | PropertyOnlyStep<boolean>;
        source?: string;
        type: "fill";
        visible?: boolean;
    }

    Hierarchy (View Summary)

    Index

    Properties

    color?: string | Property<string>

    A PAINT Property.

    "rgba(0, 0, 0, 1)"

    ex.

    { "color": "rgba(240, 2, 5, 1)" }
    

    ex.

    { "color": { "inputValue": { "key": "type", "fallback": "blue" } } }
    
    • inputValue: [See InputValue] access value in feature properties
    • dataCondition: [See DataCondition] filter based on feature property conditions
    • dataRange: [See DataRange] filter based on feature property ranges
    • inputRange: [See InputRange] filter based on map conditions like "zoom", "lon", "lat", "angle", or "pitch"
    • featureState: [See FeatureState] filter based on feature state
    • fallback: if all else fails, use this value. A value of string itself or pull from feature properties using Property
    cursor?: string

    The cursor to use when hovering over the fill. Defaults to default

    filter?: Filter

    A filter function to filter out features from the source layer.

    example:

    "filter": { "key": "class", "comparator": "==", "value": "ocean" }
    

    another example:

    "filter": {
    "or": [
    { "key": "class", "comparator": "==", "value": "ocean" },
    { "key": "class", "comparator": "==", "value": "bay" }
    ]
    }

    another example:

    "filter": {
    "and": [
    { "key": "class", "comparator": "==", "value": "ocean" },
    { "key": "size", "comparator": "==", "value": "large" },
    { "key": "type", "comparator": "!=", "value": "pacific" }
    ]
    }
    interactive?: boolean

    If true, when hovering over the fill, the property data will be sent to the UI via an Event. Defaults to false

    invert?: boolean

    If true, invert where the fill is drawn to on the map. Defaults to false

    layer?: string

    The source's layer. Default for JSON data

    lch?: boolean

    Use LCH coloring instead of RGB. Useful for color changing when the new color is very different from the old one

    maxzoom?: number

    The maximum zoom level at which the layer will be visible

    metadata?: unknown

    Additional metadata. Used by style generators.

    minzoom?: number

    The minimum zoom level at which the layer will be visible

    name?: string

    The name of the layer - useful for sorting a layer on insert or for removal

    opacity?: number | Property<number>

    A PAINT Property.

    1

    ex.

    { "opacity": 0.5 }
    

    ex.

    { "opacity": { "inputValue": { "key": "opacity", "fallback": 1 } } }
    
    • inputValue: [See InputValue] access value in feature properties
    • dataCondition: [See DataCondition] filter based on feature property conditions
    • dataRange: [See DataRange] filter based on feature property ranges
    • inputRange: [See InputRange] filter based on map conditions like "zoom", "lon", "lat", "angle", or "pitch"
    • featureState: [See FeatureState] filter based on feature state
    • fallback: if all else fails, use this value. A value of number itself or pull from feature properties using Property
    opaque?: boolean

    If true, the fill will be drawn opaque and not allow transparency. Used for performance gains. Defaults to false

    pattern?: string | PropertyOnlyStep<string>

    A LAYOUT PropertyOnlyStep.

    undefined

    ex.

    Setting up the style definition with an image:

    const style: StyleDefinition = {
    // ...
    images: { whale: '/images/whale.jpg' }
    }

    You can then add to the layer:

    { "type": "fill", "pattern": "whale" }
    
    • inputValue: [See InputValue] access value in feature properties
    • dataCondition: [See DataCondition] filter based on feature property conditions
    • dataRange: [See DataRangeStep] filter based on feature property ranges
    • inputRange: [See InputRangeStep] filter based on map conditions like "zoom", "lon", "lat", "angle", or "pitch"
    • featureState: [See FeatureState] filter based on feature state
    • fallback: if all else fails, use this value. A value of string itself or pull from feature properties using Property
    patternFamily?: string | PropertyOnlyStep<string>

    A LAYOUT PropertyOnlyStep.

    "__images"

    If left as the default, the pattern will be searched within any images added to the style. Otherwise, you're most likely using a sprite sheet and you'll need to specify the "family" of the pattern which is the name of the sprite sheet.

    ex.

    Setting up the style definition with an image:

    const style: StyleDefinition = {
    // ...
    sprites: { fishSprites: { path: 'http://...' } }
    }

    See UrlMap to use your own scheme/protocol for the URL path.

    You can then add to the layer:

    { "type": "fill", "pattern": "whale", "patternFamily": "fishSprites" }
    
    • inputValue: [See InputValue] access value in feature properties
    • dataCondition: [See DataCondition] filter based on feature property conditions
    • dataRange: [See DataRangeStep] filter based on feature property ranges
    • inputRange: [See InputRangeStep] filter based on map conditions like "zoom", "lon", "lat", "angle", or "pitch"
    • featureState: [See FeatureState] filter based on feature state
    • fallback: if all else fails, use this value. A value of string itself or pull from feature properties using Property
    patternMovement?: boolean | PropertyOnlyStep<boolean>

    A LAYOUT PropertyOnlyStep.

    false

    ex.

    { "type": "fill", "pattern": "whale", "patternMovement": true }
    
    • inputValue: [See InputValue] access value in feature properties
    • dataCondition: [See DataCondition] filter based on feature property conditions
    • dataRange: [See DataRangeStep] filter based on feature property ranges
    • inputRange: [See InputRangeStep] filter based on map conditions like "zoom", "lon", "lat", "angle", or "pitch"
    • featureState: [See FeatureState] filter based on feature state
    • fallback: if all else fails, use this value. A value of boolean itself or pull from feature properties using Property
    source?: string

    The source used to generate the layer

    type: "fill"

    Fill Style Guide

    [See LayerStyleBase]

    • name: the name of the layer, useful for sorting a layer on insert or for removal
    • source: the name of the source whose data this layer will use
    • layer: the source's layer. Defaults to "default" for JSON data
    • minzoom: the minimum zoom level at which the layer will be visible
    • maxzoom: the maximum zoom level at which the layer will be visible
    • filter: [See Filter] a filter function to filter out features from the source layer
    • lch: use LCH coloring instead of RGB. Useful for color changing when the new color is very different from the old one
    • visible: whether the layer is visible or not
    • metadata: additional metadata. Used by style generators
    • color: Color of the fill. Input either a string pull out the value using a Property.
    • opacity the opacity of the fill. Choose between [0, 1], or pull out the value using a Property.
    • pattern: Draw a pattern on the fill given an input image. Input either a string pull out the value using a PropertyOnlyStep.
    • patternMovement: Boolean flag. If true, the pattern will move with the map rather than being static. Input either a boolean or pull out the value using a PropertyOnlyStep.
    • patternFamily: If left as the default, the pattern will be searched within any images added to the style. Otherwise use a sprite sheet. Input is either a string to the sprite sheet name, or pull out the value using a PropertyOnlyStep.
    • invert: if true, invert where the fill is drawn to on the map
    • interactive: boolean flag. If true, when hovering over the fill, the property data will be sent to the UI via an Event
    • cursor: [See Cursor] the cursor to use when hovering over the fill
    • opaque: if true, the fill will be drawn opaque and not allow transparency. Used for performance gains.
    visible?: boolean

    Whether the layer is visible or not