GeoBox

public struct GeoBox : Hashable

Represents a bounding rectangle aligned with latitude and longitude. Geographic area represented by this would be visualised as a rectangle when using a normal cylindrical projection (such as Mercator). The box has a maximum span of 360 degrees in longitude and 180 degrees in latitude direction. The box with equal values in longitude for the corners is considered as a span of 360 degrees. The box is considered empty if the latitude of the GeoBox.southWestCorner is larger than the the latitude of the GeoBox.northEastCorner.

  • South west corner coordinates.

    Declaration

    Swift

    public let southWestCorner: GeoCoordinates
  • North east corner coordinates.

    Declaration

    Swift

    public let northEastCorner: GeoCoordinates
  • Creates a new instance.

    Declaration

    Swift

    public init(southWestCorner: GeoCoordinates, northEastCorner: GeoCoordinates)
  • Creates a GeoBox which encompases all coordinates from the list. The provided list must contain at least two points. The altitude values of the input coordinates are not considered for the result.

    Declaration

    Swift

    public static func containing(geoCoordinates: [GeoCoordinates]) -> GeoBox?

    Parameters

    geoCoordinates

    List of coordinates to encompass inside bounding box.

    Return Value

    GeoBox containing all supplied coordinates, or nil if less than two coordinates were provided.

  • Envelopes two GeoBox areas by returning the smallest GeoBox covering both this GeoBox and the specified GeoBox.

    Declaration

    Swift

    public func envelope(geoBox: GeoBox) -> GeoBox

    Parameters

    geoBox

    Another GeoBox to envelope with.

    Return Value

    GeoBox covering twoGeoBox areas

  • Envelopes the list of GeoBox areas by returning the smallest GeoBox covering all specified GeoBox objects.

    Declaration

    Swift

    public static func envelopeGeoBoxes(geoBoxes: [GeoBox]) -> GeoBox?

    Parameters

    geoBoxes

    List of GeoBox objects.

    Return Value

    GeoBox covering all GeoBox areas, or nil if input is empty.

  • Determines whether this GeoBox intersects with the passed GeoBox. The altitude values are ignored.

    Declaration

    Swift

    public func intersects(geoBox: GeoBox) -> Bool

    Parameters

    geoBox

    A GeoBox to check for intersection.

    Return Value

    true if intersects with the GeoBox, false otherwise.

  • Computes the intersection with the passed GeoBox. The altitude values are ignored. Limitation: Geo boxes are considered as non-intersecting if they overlap only on a single point, horizontal line or vertical line.

    Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.

    Declaration

    Swift

    public func intersection(geoBox: GeoBox) -> [GeoBox]

    Parameters

    geoBox

    Another geo box to check intersection with.

    Return Value

    It will be empty if there is no overlap. Otherwise, 1 or more geo boxes covering common area by this and passed GeoBox.

  • Computes intersection of list of GeoBox instances. The altitude values are ignored. Limitation: Geo boxes are considered as non-intersecting if they overlap only on a single point, horizontal line or vertical line.

    Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.

    Declaration

    Swift

    public static func intersection(geoBoxes: [GeoBox]) -> [GeoBox]

    Parameters

    geoBoxes

    List of GeoBox instances.

    Return Value

    It will be empty if there is no overlap between all the passed GeoBox instances. Otherwise, 1 or more geo boxes covering common area by all the passed GeoBox instances.

  • Determines whether the specified GeoBox is covered entirely by this GeoBox. The altitude values are ignored.

    Declaration

    Swift

    public func contains(geoBox: GeoBox) -> Bool

    Parameters

    geoBox

    A GeoBox to check for containment within this GeoBox.

    Return Value

    true if covered by the GeoBox, false otherwise.

  • Determines whether the specified GeoCoordinates is contained within this GeoBox. The altitude values are ignored.

    Declaration

    Swift

    public func contains(geoCoordinates: GeoCoordinates) -> Bool

    Parameters

    geoCoordinates

    A GeoCoordinates to check for containment within this GeoBox.

    Return Value

    true if contained within the GeoBox, false otherwise.

  • Creates a GeoBox which is expanded by a fixed distance. Throws an InstantiationError if it is not possible to create a valid GeoBox with the given arguments.

    Throws

    InstantiationError Instantiation error.

    Declaration

    Swift

    public func expandedBy(southMeters: Double, westMeters: Double, northMeters: Double, eastMeters: Double) throws -> GeoBox

    Parameters

    southMeters

    Distance in the south direction in meters to expand the GeoBox.

    westMeters

    Distance in the west direction in meters to expand the GeoBox.

    northMeters

    Distance in the north direction in meters to expand the GeoBox.

    eastMeters

    Distance in the east direction in meters to expand the GeoBox.

    Return Value

    The expanded GeoBox.