MTBoundingBox
public struct MTBoundingBox : Codable, Equatable, Sendable
A bounding box in WGS84 coordinates.
-
Undocumented
Declaration
Swift
public let minLon: Double -
Undocumented
Declaration
Swift
public let minLat: Double -
Undocumented
Declaration
Swift
public let maxLon: Double -
Undocumented
Declaration
Swift
public let maxLat: Double -
Returns
trueif the bounding box spans across the antimeridian (180th meridian).Declaration
Swift
public var crossesAntimeridian: Bool { get } -
Undocumented
Declaration
Swift
public init(minLon: Double, minLat: Double, maxLon: Double, maxLat: Double) -
Checks if this bounding box intersects with another bounding box.
Declaration
Swift
public func intersects(with other: MTBoundingBox) -> BoolParameters
otherThe other bounding box to check against.
Return Value
trueif the bounding boxes intersect, otherwisefalse.
-
The maximum latitude limit for Web Mercator projection.
Declaration
Swift
public static let maxWebMercatorLat: Double -
Normalizes a longitude to the standard range [-180, 180].
Declaration
Swift
public static func normalizeLongitude(_ longitude: Double) -> DoubleParameters
longitudeThe raw longitude.
Return Value
A normalized longitude.
-
Clamps a latitude to the Web Mercator valid range (-85.0511… to 85.0511…).
Declaration
Swift
public static func clampLatitude(_ latitude: Double) -> DoubleParameters
latitudeThe raw latitude.
Return Value
A clamped latitude.
-
Normalizes the bounding box coordinates and splits it into two if it crosses the antimeridian (Dateline).
Declaration
Swift
public func normalizedAndSplit() -> [MTBoundingBox]Return Value
An array containing one normalized bounding box, or two if it crosses the antimeridian.
-
Creates a bounding box from an array of coordinates.
Declaration
Swift
public init?(coordinates: [CLLocationCoordinate2D])Parameters
coordinatesAn array of coordinates (e.g. forming a polygon or line).
Return Value
A bounding box enclosing all coordinates, or nil if the array is empty.
-
Expands the bounding box outward by a given distance in meters.
Declaration
Swift
public func expanded(byMeters meters: Double) -> MTBoundingBoxParameters
metersThe distance in meters to expand.
Return Value
A new expanded bounding box.
-
Expands the bounding box outward by a given percentage.
Declaration
Swift
public func expanded(by percentage: Double) -> MTBoundingBoxParameters
percentageThe percentage to expand (e.g., 0.1 for a 10% buffer).
Return Value
A new expanded bounding box.
-
Calculates the approximate surface area in square kilometers.
Declaration
Swift
public var areaInSquareKilometers: Double { get } -
Estimates the exact number of tiles required for this bounding box within the specified zoom range.
Declaration
Swift
public func estimatedTileCount(zoomRange: MTOfflineZoomRange) -> IntParameters
zoomRangeThe min and max zoom levels.
Return Value
The total tile count.
-
Estimates the number of tiles required per zoom level for this bounding box.
Declaration
Swift
public func estimatedTileCountPerZoom(zoomRange: MTOfflineZoomRange) -> [Int : Int]Parameters
zoomRangeThe min and max zoom levels.
Return Value
A dictionary mapping each zoom level to its tile count.
-
Creates a bounding box that contains all the given coordinates.
Declaration
Swift
public init(from coordinates: [CLLocationCoordinate2D])Parameters
coordinatesThe coordinates to include.