MKMapView(AerisMapKit)
@interface MKMapView (AerisMapKit)
Extensions and utility methods for MKMapView.
-
Returns the current zoom level as an integer from 1 to 20 based on the map’s current zoom scale and region.
Declaration
Objective-C
- (NSUInteger)awf_zoomLevel;Swift
func awf_zoomLevel() -> UIntReturn Value
The current zoom level
-
Returns the current zoom scale for the map.
Declaration
Objective-C
- (MKZoomScale)awf_zoomScale;Swift
func awf_zoomScale() -> MKZoomScaleReturn Value
The current zoom scale
-
Sets the map’s center coordinate and zoom level.
Declaration
Objective-C
- (void)awf_setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(NSUInteger)zoomLevel animated:(BOOL)animated;Swift
func awf_setCenter(_ centerCoordinate: CLLocationCoordinate2D, zoomLevel: UInt, animated: Bool)Parameters
centerCoordinateThe center coordinate for the map
zoomLevelThe zoom level
animatedA Boolean indicating whether or not the change should be animated
-
Returns a new coordinate based on a coordinate, point offset and zoom level regardless of the map’s current zoom level.
Declaration
Objective-C
- (CLLocationCoordinate2D) awf_coordinateByOffsettingCenterCoordinate: (CLLocationCoordinate2D)centerCoordinate offset:(UIOffset)offset zoomLevel:(NSUInteger)zoomLevel;Swift
func awf_coordinate(byOffsettingCenter centerCoordinate: CLLocationCoordinate2D, offset: UIOffset, zoomLevel: UInt) -> CLLocationCoordinate2DParameters
centerCoordinateThe coordinate from which to calculate the offset from
offsetThe pixel offset from the
coordinatezoomLevelThe zoom level to use for the calculation
Return Value
A new coordinate that is
offsetpixels fromcenterCoordinatefor the givenzoomLevel
-
Returns the northwest (top-left) coordinate of the visible map bounds.
Declaration
Objective-C
- (CLLocationCoordinate2D)awf_northwestCoordinate;Swift
func awf_northwestCoordinate() -> CLLocationCoordinate2DReturn Value
CLLocationCoordinate2D
-
Returns the southwest (bottom-left) coordinate of the visible map bounds.
Declaration
Objective-C
- (CLLocationCoordinate2D)awf_southwestCoordinate;Swift
func awf_southwestCoordinate() -> CLLocationCoordinate2DReturn Value
CLLocationCoordinate2D
-
Returns the northeast (top-right) coordinate of the visible map bounds.
Declaration
Objective-C
- (CLLocationCoordinate2D)awf_northeastCoordinate;Swift
func awf_northeastCoordinate() -> CLLocationCoordinate2DReturn Value
CLLocationCoordinate2D
-
Returns to southeast (bottom-right) coordinate of the visible map bounds.
Declaration
Objective-C
- (CLLocationCoordinate2D)awf_southeastCoordinate;Swift
func awf_southeastCoordinate() -> CLLocationCoordinate2DReturn Value
CLLocationCoordinate2D
-
Returns a map tile’s x and y grid locations that a coordinate falls within at the specified zoom level.
The tile grid location calculations are based on the standard 256x256 tile sizes that most mapping APIs use. The zoom level should be a value from 1 to 20 and is based on the map’s zoom scale. You can retrieve the map’s current zoom level using the
awf_zoomLevelcategory method provided.Declaration
Objective-C
- (CGPoint)awf_tileXYForCoordinate:(CLLocationCoordinate2D)coord zoomLevel:(NSUInteger)zoomLevel;Swift
func awf_tileXY(for coord: CLLocationCoordinate2D, zoomLevel: UInt) -> CGPointParameters
coordThe coordinate to use when determining the tile grid location
zoomLevelThe map zoom level to use in determining the tile grid location
Return Value
The tile’s x and y grid location to be used when requesting the proper tile.
-
Calculates the coordinate bounds at the corners of the tile at a specific grid location and zoom level.
Declaration
Objective-C
- (nonnull AWFMapCoordinateBounds *)af_coordinateBoundsForTileAtX:(NSUInteger)x y:(NSUInteger)y;Swift
func af_coordinateBoundsForTileAt(x: UInt, y: UInt) -> AWFMapCoordinateBoundsParameters
xThe tile’s x coordinate.
yThe tile’s y coordinate.
Return Value
An
AWFMapCoordinateBoundsinstance with the calculated coordinates for the four corners and center.
View on GitHub
MKMapView(AerisMapKit) Category Reference