# Ring

``public struct Ring``
``extension Ring: Codable``

A linear ring is a closed figure bounded by three or more straight line segments.

• ``` coordinates ```

The positions at which the linear ring is located.

#### Declaration

Swift

``public var coordinates: [LocationCoordinate2D]``
• ``` init(coordinates:) ```

Initializes a linear ring defined by the given positions.

#### Declaration

Swift

``public init(coordinates: [LocationCoordinate2D])``

#### Parameters

 ``` coordinates ``` The positions at which the linear ring is located.
• ``` area ```

Calculate the approximate area of the polygon were it projected onto the earth, in square meters. Note that this area will be positive if ring is oriented clockwise, otherwise it will be negative.

Reference: Robert. G. Chamberlain and William H. Duquette, “Some Algorithms for Polygons on a Sphere”, JPL Publication 07-03, Jet Propulsion Laboratory, Pasadena, CA, June 2007 https://trs.jpl.nasa.gov/handle/2014/41271

#### Declaration

Swift

``public var area: Double { get }``
• ``` contains(_:ignoreBoundary:) ```

Determines if the given point falls within the ring. The optional parameter `ignoreBoundary` will result in the method returning true if the given point lies on the boundary line of the ring.

#### Declaration

Swift

``public func contains(_ coordinate: LocationCoordinate2D, ignoreBoundary: Bool = false) -> Bool``
• ``` init(from:) ```

#### Declaration

Swift

``public init(from decoder: Decoder) throws``
• ``` encode(to:) ```

#### Declaration

Swift

``public func encode(to encoder: Encoder) throws``