BoundingBox
public struct BoundingBox : Codable, Hashable
Bounding box is an area defined by two longitudes and two latitudes, where: Latitude is a decimal number between -90.0 and 90.0. Longitude is a decimal number between -180.0 and 180.0.
-
The most south and west coordinate in bounding box
Declaration
Swift
public var southWest: CLLocationCoordinate2D { get set } -
The most north and east coordinate in bounding box
Declaration
Swift
public var northEast: CLLocationCoordinate2D { get set } -
Build
BoundingBoxwith array of coordinatesConstructor would search for the minimal and maximum latitude and longitude.
Declaration
Swift
public init?(from coordinates: [CLLocationCoordinate2D]?)Parameters
coordinatesCollection of coordinates. Recommended minimum is 4 coordinates and meaningful maximum.
-
Build
BoundingBoxbased on south-west (bottom-left) and north-east (top-right) coordinatesDeclaration
Swift
public init(_ southWest: CLLocationCoordinate2D, _ northEast: CLLocationCoordinate2D)Parameters
southWestThe most south-west coordinate in bounding box
northEastThe most north-east coordinate in bounding box
-
Returns a Boolean value indicating whether the
BoundingBoxcontains the coordinate.Declaration
Swift
public func contains(_ coordinate: CLLocationCoordinate2D, ignoreBoundary: Bool = true) -> BoolParameters
coordinateThe coordinate to find in the bounding box.
ignoreBoundarytrueif coordinate on the boundary is suitableReturn Value
trueif coordinates was found
BoundingBox Structure Reference