• JMap.Map.getRenderedFeatures

    Returns rendered geojson features for the specified Jmap layer. Features that are not rendered (i.e. filtered by the Map JS library) are not returned

    If the JMap layer is not visible, no features are returned.

    The Map JS library splits geometries along tiles internally, meaning for instance that a polygon feature that crosses many tiles will be returned as multiple polygon pieces (sharing all properties of the original source features). By default, getRenderedFeatures will only return one of those pieces (a random one). If you pass a JGetRenderedFeaturesParams with keepAllTiles = true, all feature pieces will be returned by getRenderedFeatures.

    Parameters

    Returns GeoJSON.Feature[]

    A features array

    Throws

    Error if layer is not found

    Throws

    Error if no or incorrect filter is passed

    Example

    // Returns all rendered geojson features for layer 4
    JMap.Map.getRenderedFeatures(4)

    // Returns all rendered geojson features for layer 4 at location x=45.54 and y=65.43
    JMap.Map.getRenderedFeatures(4, { x: 45.54, y: 65.43 })

    // Returns all rendered geojson features for layer 4, that intersect the circle (radius in km)
    JMap.Map.getRenderedFeatures(4, { center: { x: 45.54, y: 65.43 }, radius: .5 })

    // Returns all rendered geojson features for layer 4, that intersect the boundary box
    // having south-west { x=45.54 and y=65.43 } and north-est { x=48.54 and y=70.43 }
    JMap.Map.getRenderedFeatures(4, {
    sw: { x: 45.54, y: 65.43 },
    ne: { x: 48.54, y: 70.43 }
    })

    // Returns all rendered geojson features for layer 4 that intersect a circle (radius in km), without any Map JS library filter
    JMap.Map.getRenderedFeatures(4, {geoFilter: { center: { x: 45.54, y: 65.43 }, radius: .5 }})