• JMap.Geometry.getCentroid

    Returns a point feature representing the centroid of the provided feature or featureCollection.

    Parameters

    • feature: Feature<Geometry, GeoJsonProperties> | FeatureCollection<Geometry, GeoJsonProperties>

      a feature or a feature collection

    Returns GeoJSON.Feature<GeoJSON.Point>

    Example

    const polygonFeature = ...
    // The method will return the centroid of "polygonFeature" as a point feature
    JMap.Geometry.getCentroid(polygonFeature)