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
GeoBoxwhich 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
geoCoordinatesList of coordinates to encompass inside bounding box.
Return Value
GeoBoxcontaining all supplied coordinates, ornilif less than two coordinates were provided. -
Envelopes two
GeoBoxareas by returning the smallestGeoBoxcovering both this GeoBox and the specifiedGeoBox.Declaration
Swift
public func envelope(geoBox: GeoBox) -> GeoBoxParameters
geoBoxAnother
GeoBoxto envelope with.Return Value
GeoBoxcovering twoGeoBoxareas -
Envelopes the list of
GeoBoxareas by returning the smallestGeoBoxcovering all specifiedGeoBoxobjects.Declaration
Swift
public static func envelopeGeoBoxes(geoBoxes: [GeoBox]) -> GeoBox?Parameters
geoBoxesList of
GeoBoxobjects.Return Value
GeoBoxcovering allGeoBoxareas, ornilif input is empty. -
Determines whether this
GeoBoxintersects with the passedGeoBox. The altitude values are ignored.Declaration
Swift
public func intersects(geoBox: GeoBox) -> BoolParameters
geoBoxA
GeoBoxto check for intersection.Return Value
trueif intersects with theGeoBox,falseotherwise. -
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
geoBoxAnother 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
GeoBoxinstances. 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
geoBoxesList of
GeoBoxinstances.Return Value
It will be empty if there is no overlap between all the passed
GeoBoxinstances. Otherwise, 1 or more geo boxes covering common area by all the passedGeoBoxinstances. -
Determines whether the specified
GeoBoxis covered entirely by thisGeoBox. The altitude values are ignored.Declaration
Swift
public func contains(geoBox: GeoBox) -> BoolParameters
geoBoxA
GeoBoxto check for containment within thisGeoBox.Return Value
trueif covered by theGeoBox,falseotherwise. -
Determines whether the specified GeoCoordinates is contained within this
GeoBox. The altitude values are ignored.Declaration
Swift
public func contains(geoCoordinates: GeoCoordinates) -> BoolParameters
geoCoordinatesA GeoCoordinates to check for containment within this
GeoBox.Return Value
trueif contained within theGeoBox,falseotherwise. -
Creates a
GeoBoxwhich is expanded by a fixed distance. Throws an InstantiationError if it is not possible to create a validGeoBoxwith the given arguments.Throws
InstantiationErrorInstantiation error.Declaration
Swift
public func expandedBy(southMeters: Double, westMeters: Double, northMeters: Double, eastMeters: Double) throws -> GeoBoxParameters
southMetersDistance in the south direction in meters to expand the
GeoBox.westMetersDistance in the west direction in meters to expand the
GeoBox.northMetersDistance in the north direction in meters to expand the
GeoBox.eastMetersDistance in the east direction in meters to expand the
GeoBox.Return Value
The expanded
GeoBox.