• JMap.Map.Selection.getSelectionCentroid

    Parameters

    Returns JLocation

    a JLocation representing the centroid of the selection

    Throws

    Error if selection is empty

    Example

    // get the current selected features by layer id
    const selection = JMap.Map.Selection.getSelectedFeatures()

    // compute the centroid of the selection
    const centroid = JMap.Map.Selection.getSelectionCentroid(selection)

    console.log(`centroid of selection is located at: LAT: ${centroid.y}, LON: ${centroid.x}`)