• JMap.Map.Filter.applySpatial

    Render only layer's features that intersect the filterGeometry area.

    Only one spatial filter can be set for a specific layer at the same time.

    Parameters

    • layerId: JId

      The JMap layer id

    • filterGeometry: JCircle | JPolygon

      The geometry that is the area to search. Can be a circle or a polygon.

    Returns string

    The filter id. By example for layer 4 => "spatial-4"

    Throws

    Error if layer is not found, or filterGeometry format is not good

    Example

    // Will render features that intersect the circle of radius 500 (in km) centered at location x=20 and y=10.
    JMap.Map.Filter.applySpatial(4, { radius: 500, center:x: 20, y: 10 }})

    // Will render features that intersect the polygon (in this case a square)
    JMap.Map.Filter.applySpatial(4, [ [ 20.44, 10.32 ], [ 20.44, 78.44 ], [ 40.56, 78.44 ], [ 40.56, 10.32 ], [ 20.44, 10.32 ] ])