NavigationMapView

open class NavigationMapView : MGLMapView, UIGestureRecognizerDelegate

NavigationMapView is a subclass of MGLMapView with convenience functions for adding Route lines to a map.

  • The minimum preferred frames per second at which to render map animations.

    This property takes effect when the application has limited resources for animation, such as when the device is running on battery power. By default, this property is set to MGLMapViewPreferredFramesPerSecond.lowPower.

    Declaration

    Swift

    public var minimumFramesPerSecond: MGLMapViewPreferredFramesPerSecond
  • Returns the altitude that the map camera initally defaults to.

    Declaration

    Swift

    public var defaultAltitude: CLLocationDistance
  • Returns the altitude the map conditionally zooms out to when user is on a motorway, and the maneuver length is sufficently long.

    Declaration

    Swift

    public var zoomedOutMotorwayAltitude: CLLocationDistance
  • Returns the threshold for what the map considers a “long-enough” maneuver distance to trigger a zoom-out when the user enters a motorway.

    Declaration

    Swift

    public var longManeuverDistance: CLLocationDistance
  • Maximum distance the user can tap for a selection to be valid when selecting an alternate route.

    Declaration

    Swift

    public var tapGestureDistanceThreshold: CGFloat
  • A collection of street road classes for which a congestion level substitution should occur.

    For any street road class included in the roadClassesWithOverriddenCongestionLevels, all route segments with an CongestionLevel.unknown traffic congestion level and a matching MapboxDirections.MapboxStreetsRoadClass will be replaced with the CongestionLevel.low congestion level.

    Declaration

    Swift

    public var roadClassesWithOverriddenCongestionLevels: Set<MapboxStreetsRoadClass>?
  • The object that acts as the navigation delegate of the map view.

    Declaration

    Swift

    public weak var navigationMapViewDelegate: NavigationMapViewDelegate?
  • The object that acts as the course tracking delegate of the map view.

    Declaration

    Swift

    public weak var courseTrackingDelegate: NavigationMapViewCourseTrackingDelegate?
  • Showcases route array. Adds routes and waypoints to map, and sets camera to point encompassing the route.

    Declaration

    Swift

    public static let defaultPadding: UIEdgeInsets
  • Adds or updates both the route line and the route line casing.

    This method will be called multiple times: • When the route preview map is shown, rendering alternative routes if necessary. • When the navigation session starts, rendering only the single route line.

    Declaration

    Swift

    public func show(_ routes: [Route], legIndex: Int = 0)
  • Attempts to localize road labels into the local language and other labels into the system’s preferred language.

    When this property is enabled, the style automatically modifies the text property of any symbol style layer whose source is the Mapbox Streets source. On iOS, the user can set the system’s preferred language in Settings, General Settings, Language & Region.

    Unlike the MGLStyle.localizeLabels(into:) method, this method localizes road labels into the local language, regardless of the system’s preferred language, in an effort to match road signage. The turn banner always displays road names and exit destinations in the local language, so you should call this method in the MGLMapViewDelegate.mapView(_:didFinishLoading:) method of any delegate of a standalone NavigationMapView. The map view embedded in NavigationViewController is localized automatically, so you do not need to call this method on the value of NavigationViewController.mapView.

    Declaration

    Swift

    public func localizeLabels()
  • Sets the camera directly over a series of coordinates.

    Declaration

    Swift

    public func setOverheadCameraView(from userLocation: CLLocation, along lineString: LineString, for padding: UIEdgeInsets)
  • Recenters the camera and begins tracking the user’s location.

    Declaration

    Swift

    public func recenterMap()
  • Receives coordinates for searching the map for buildings. If buildings are found, they will be highlighted in 2D or 3D depending on the in3D value.

    Declaration

    Swift

    @discardableResult
    public func highlightBuildings(at coordinates: [CLLocationCoordinate2D], in3D extrudesBuildings: Bool = true) -> Bool

    Parameters

    coordinates

    Coordinates which represent building locations.

    extrudesBuildings

    Switch which allows to highlight buildings in either 2D or 3D. Defaults to true.

    Return Value

    Bool indicating if number of buildings found equals number of coordinates supplied.

  • Removes the highlight from all buildings highlighted by highlightBuildings(at:in3D:).

    Declaration

    Swift

    public func unhighlightBuildings()