Function getRenderedFeaturesAttributeValues

  • JMap.Map.getRenderedFeaturesAttributeValues

    Returns rendered features attributes for the layer.

    The result is an array of object, one object for each feature. Each object contains all feature's attributes, plus another one that is called "featureId" and contains the feature id.

    Parameters

    • layerId: JId

      The JMap layer id

    • Optional filter: JLocation | JBoundaryBox | JCircle

      You can pass a location, a boundary box, or a circle (radius in km). Will returns only features that intersect.

    Returns JMapFeatureAttributeValues[]

    An object array

    Throws

    Error if layer is not found

    Throws

    Error if no or incorrect filter is passed

    Example

    // returns all features attributes for layer 4
    JMap.Map.getRenderedFeaturesAttributeValues(4)

    // returns all features attributes for layer 4, that intersect the location
    JMap.Map.getRenderedFeaturesAttributeValues(4, { x: 45.54, y: 65.43 })

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

    // returns all features attributes for layer 4, that intersect the boundary box
    JMap.Map.getRenderedFeaturesAttributeValues(4, { sw: { x: 45.54, y: 65.43 }, ne: { x: 48.54, y: 70.43 }})

    // Example of result for features that have only 2 attributes "Firestation" and "Nursery" :
    [
    { name: "Firestation", age: 23, featureId: 2377 },
    { name: "Nursery", age: 20, featureId: 3456 }
    ]