• JMap.Geometry.getPolygonFeature

    Returns a polygon feature from coordinates.

    If the coordinates are not closed the method will close it automatically.

    Parameters

    • coordinates: JPoint[]

      the polygon coordinates (closed or not closed)

    • Optional closeCoordinates: boolean

      if true will close the coordinates (if needed)

    Returns GeoJSON.Feature<GeoJSON.Polygon>

    Example

    // will close the coordinates of the polygon and returns the feature
    const distance = JMap.Geometry.getPolygonFeature([
    [ 10, 20 ],
    [ 30, 30 ],
    [ 10, 60 ]
    ])