Other Functions
The following functions are available globally.
MGLMapPointMake
Creates a new MGLMapPoint
from the given X and Y coordinates, and zoom level.
Declaration
Objective-C
static inline MGLMapPoint MGLMapPointMake(CGFloat x, CGFloat y,
CGFloat zoomLevel)
Swift
func MGLMapPointMake(_ x: CGFloat, _ y: CGFloat, _ zoomLevel: CGFloat) -> MGLMapPoint
MGLMapPointForCoordinate
Returns Mercator projection of a WGS84 coordinate at the specified zoom level.
Declaration
Objective-C
extern MGLMapPoint MGLMapPointForCoordinate(CLLocationCoordinate2D coordinate,
double zoomLevel)
Swift
func MGLMapPointForCoordinate(_ coordinate: CLLocationCoordinate2D, _ zoomLevel: Double) -> MGLMapPoint
MGLAltitudeForZoomLevel
Converts a map zoom level to a camera altitude.
Declaration
Objective-C
extern CLLocationDistance MGLAltitudeForZoomLevel(double zoomLevel,
CGFloat pitch,
CLLocationDegrees latitude,
CGSize size)
Swift
func MGLAltitudeForZoomLevel(_ zoomLevel: Double, _ pitch: CGFloat, _ latitude: CLLocationDegrees, _ size: CGSize) -> CLLocationDistance
Parameters
zoomLevel
The zoom level to convert.
pitch
The camera pitch, measured in degrees.
latitude
The latitude of the point at the center of the viewport.
size
The size of the viewport.
Return Value
An altitude measured in meters.
MGLZoomLevelForAltitude
Converts a camera altitude to a map zoom level.
Declaration
Objective-C
extern double MGLZoomLevelForAltitude(CLLocationDistance altitude,
CGFloat pitch, CLLocationDegrees latitude,
CGSize size)
Swift
func MGLZoomLevelForAltitude(_ altitude: CLLocationDistance, _ pitch: CGFloat, _ latitude: CLLocationDegrees, _ size: CGSize) -> Double
Parameters
altitude
The altitude to convert, measured in meters.
pitch
The camera pitch, measured in degrees.
latitude
The latitude of the point at the center of the viewport.
size
The size of the viewport.
Return Value
A zero-based zoom level.
MGLSphericalPositionMake
Creates a new MGLSphericalPosition
from the given radial, azimuthal, polar.
Declaration
Objective-C
static inline MGLSphericalPosition
MGLSphericalPositionMake(CGFloat radial, CLLocationDirection azimuthal,
CLLocationDirection polar)
Swift
func MGLSphericalPositionMake(_ radial: CGFloat, _ azimuthal: CLLocationDirection, _ polar: CLLocationDirection) -> MGLSphericalPosition
Parameters
radial
The radial coordinate.
azimuthal
The azimuthal angle.
polar
The polar angle.
Return Value
Returns a MGLSphericalPosition
struct containing the position attributes.
MGLTransitionMake
Creates a new MGLTransition
from the given duration and delay.
Declaration
Objective-C
static inline MGLTransition MGLTransitionMake(NSTimeInterval duration,
NSTimeInterval delay)
Swift
func MGLTransitionMake(_ duration: TimeInterval, _ delay: TimeInterval) -> MGLTransition
Parameters
duration
The amount of time the animation should take, not including the delay.
delay
The amount of time in seconds to wait before beginning the animation.
Return Value
Returns a MGLTransition
struct containing the transition attributes.
iOS SDK
Examples
SDK JS Reference
- Annotations
- Appendices
- NSExpression(MGLAdditions)
- NSValue(MGLAdditions)
- NSValue(MGLCircleStyleLayerAdditions)
- NSValue(MGLFillExtrusionStyleLayerAdditions)
- NSValue(MGLFillStyleLayerAdditions)
- NSValue(MGLHillshadeStyleLayerAdditions)
- NSValue(MGLLineStyleLayerAdditions)
- NSValue(MGLRasterStyleLayerAdditions)
- NSValue(MGLSymbolStyleLayerAdditions)
- MGLAccountManager
- MGLAnnotationImage
- MGLAnnotationView
- MGLAttributedExpression
- MGLAttributionInfo
- MGLBackgroundStyleLayer
- MGLCircleStyleLayer
- MGLClockDirectionFormatter
- MGLCompassButton
- MGLCompassDirectionFormatter
- MGLComputedShapeSource
- MGLCoordinateFormatter
- MGLDistanceFormatter
- MGLFillExtrusionStyleLayer
- MGLFillStyleLayer
- MGLForegroundStyleLayer
- MGLHeatmapStyleLayer
- MGLHillshadeStyleLayer
- MGLImageSource
- MGLLight
- MGLLineStyleLayer
- MGLLoggingConfiguration
- MGLMapCamera
- MGLMapSnapshot
- MGLMapSnapshotOptions
- MGLMapSnapshotOverlay
- MGLMapSnapshotter
- MGLMapView
- MGLMultiPoint
- MGLMultiPolygon
- MGLMultiPolyline
- MGLNetworkConfiguration
- MGLOfflinePack
- MGLOfflineStorage
- MGLPointAnnotation
- MGLPointCollection
- MGLPolygon
- MGLPolyline
- MGLRasterStyleLayer
- MGLRasterTileSource
- MGLShape
- MGLShapeCollection
- MGLShapeOfflineRegion
- MGLShapeSource
- MGLSource
- MGLStyle
- MGLStyleLayer
- MGLSymbolStyleLayer
- MGLTilePyramidOfflineRegion
- MGLTileSource
- MGLUserLocation
- MGLUserLocationAnnotationView
- MGLUserLocationAnnotationViewStyle
- MGLVectorStyleLayer
- MGLVectorTileSource
- MGLAnnotationVerticalAlignment
- MGLAnnotationViewDragState
- MGLAttributionInfoStyle
- MGLCirclePitchAlignment
- MGLCircleScaleAlignment
- MGLCircleTranslationAnchor
- MGLDEMEncoding
- MGLErrorCode
- MGLFillExtrusionTranslationAnchor
- MGLFillTranslationAnchor
- MGLHillshadeIlluminationAnchor
- MGLIconAnchor
- MGLIconPitchAlignment
- MGLIconRotationAlignment
- MGLIconTextFit
- MGLIconTranslationAnchor
- MGLLightAnchor
- MGLLineCap
- MGLLineJoin
- MGLLineTranslationAnchor
- MGLLoggingLevel
- MGLMapDebugMaskOptions
- MGLOfflinePackState
- MGLOrnamentPosition
- MGLOrnamentVisibility
- MGLRasterResamplingMode
- MGLResourceKind
- MGLSymbolPlacement
- MGLSymbolZOrder
- MGLTextAnchor
- MGLTextJustification
- MGLTextPitchAlignment
- MGLTextRotationAlignment
- MGLTextTransform
- MGLTextTranslationAnchor
- MGLTextWritingMode
- MGLTileCoordinateSystem
- MGLUserTrackingMode
- Formatters
- Geometry
- Location Updates
- Maps
- Offline Maps
- Other Categories
- Other Classes
- Other Constants
- Other Enumerations
- Other Functions
- Other Protocols
- Other Structures
- Other Type Definitions
- Primitive Shapes
- MGLAnnotation
- MGLCalloutView
- MGLCalloutViewDelegate
- MGLCluster
- MGLComputedShapeSourceDataSource
- MGLFeature
- MGLLocationManager
- MGLLocationManagerDelegate
- MGLMapSnapshotterDelegate
- MGLMapViewDelegate
- MGLOfflineRegion
- MGLOfflineStorageDelegate
- MGLOverlay
- MGLStylable
- MGLCoordinateBounds
- MGLCoordinateQuad
- MGLCoordinateSpan
- MGLOfflinePackProgress
- MGLSphericalPosition
- MGLTransition
- Style Content
- Style Layers
- Style Primitives
- Styling the Map
- MGLCoordinateBounds
- MGLCoordinateQuad
- MGLCoordinateSpan
- MGLOfflinePackProgress
- MGLSphericalPosition
- MGLTransition
- User Interaction
- Customizing Fonts
- Information for Style Authors
- Gesture Recognizers
- Info.plist Keys
- Migrating to Expressions
- Predicates and expressions
- Tile URL Templates
- Working with GeoJSON Data