• JMap.Map.Selection.setLayerSelection

    Set the selection for a specific layer.

    Cancel previous selection if exist, and replace by new selection

    Parameters

    • layerId: JId

      The JMap layer id

    • features: Feature<Geometry, GeoJsonProperties> | Feature<Geometry, GeoJsonProperties>[]

      The new selection. This is what will be selected on the map

    Returns void

    Throws

    Error if layer is not found or features format is not good

    Example

    // will select feature (id = 234) of layer 4 on the map
    JMap.Map.Selection.setLayerSelection(4, {
    id: 234,
    type: "Point",
    geometry: {...},
    properties: [...]
    })

    // will select two features (id = 234 and 567) of layer 4 on the map
    JMap.Map.Selection.setLayerSelection(4, [
    {
    id: 234,
    type: "Point",
    geometry: {...},
    properties: [...]
    },
    {
    id: 567,
    type: "Point",
    geometry: {...},
    properties: [...]
    }
    ])