GLMapView
@interface GLMapView : UIView <CLLocationManagerDelegate>
GLMapView is a custom UIView that renders and presents vector map.
-
Captures frame from
GLMapViewtoUIImageDeclaration
Objective-C
- (nullable UIImage *)captureFrame;Return Value
Current state of the
GLMapView -
Captures frame from
GLMapViewtoUIImagewhen all load operations will finish.See
See
Declaration
Objective-C
- (void)captureFrameWhenFinish:(nonnull GLMapCaptureFrameBlock)block;Parameters
blockBlock callback is called when screenshot is ready.
-
Allows to render offscreen frames
By default offscreen =
NO. And GLMapView stop render if there is no superview. But in case you need to capture frames from standalone GLMapView, you need to set offscreen = YES;Declaration
Objective-C
@property (atomic, assign, unsafe_unretained, readwrite) BOOL offscreen; -
Rendering frame interval. By default frameInterval is 2 (30 fps)
Declaration
Objective-C
@property (atomic, assign, unsafe_unretained, readwrite) NSInteger frameInterval; -
State of tile in center of screen
Declaration
Objective-C
@property (atomic, readonly) GLMapTileState centerTileState;
-
Sets mask that defines enabled gestures.
Use
tapGestureBlockandlongPressGestureBlockto add your tap and long press handlers.Declaration
Objective-C
@property (nonatomic, assign, unsafe_unretained, readwrite) GLMapViewGestures gestureMask; -
tapGestureBlockcalled for each tap gesture recognized.Declaration
Objective-C
@property (atomic, copy, readwrite) GLMapTapGestureBlock _Nullable tapGestureBlock; -
longPressGestureBlockcalled for each long press gesture recognized.Declaration
Objective-C
@property (atomic, copy, readwrite) GLMapTapGestureBlock _Nullable longPressGestureBlock; -
bboxChangedBlockcalled when map is moved or zoomed.Declaration
Objective-C
@property (atomic, copy, readwrite) GLMapBBoxChangedBlock _Nullable bboxChangedBlock; -
mapDidMoveBlockcalled when animation or deceleration ends.Declaration
Objective-C
@property (atomic, copy, readwrite) GLMapBBoxChangedBlock _Nullable mapDidMoveBlock; -
visibleTilesChangedBlockcalled when set of visible tiles is changed.Declaration
Objective-C
@property (atomic, copy, readwrite) GLMapVisibleTilesChangedBlock _Nullable visibleTilesChangedBlock; -
centerTileStateChangedBlockcalled when centerTileState is changedDeclaration
Objective-C
@property (atomic, copy, readwrite) dispatch_block_t _Nullable centerTileStateChangedBlock; -
Bounding box of the map
Declaration
Objective-C
@property (atomic, readonly) GLMapBBox bbox; -
Sets position of map attribution.
Declaration
Objective-C
@property (atomic, assign, unsafe_unretained, readwrite) GLMapPlacement attributionPosition; -
Sets text at the bottom of ruler.
It’s used to display map center coordinates or any other useful information
Declaration
Objective-C
- (void)setScaleRulerBottomText:(NSString *_Nullable)text; -
Sets style of text at the bottom of ruler. Defaul is “{font-size:11; text-color:black; fill-color:#000000B2; font-stroke-width:2pt; font-stroke-color:#FFFFFF99;}
Declaration
Objective-C
- (void)setScaleRulerBottomTextStyle:(nonnull GLMapVectorStyle *)style; -
Sets style of the scale ruler.
//Sets scale ruler position to the bottom center part of screen. And width to half of screen width [_mapView setScaleRulerUnits:AppSettings.settings.units placement:GLMapPlacement_BottomLeft paddings:CGPointMake(5, 5) maxWidth:300];Declaration
Objective-C
- (void)setScaleRulerStyle:(GLUnitSystem)unitSystem placement:(GLMapPlacement)placement paddings:(CGPoint)paddings maxWidth:(float)maxWidth;Parameters
unitSystemUnit system used by scale ruler
placementplacement of text
paddingspaddings of scale ruler
maxWidthmaxWidth of scale hit in points
-
Sets block that called when ruler value is updated. Block allows to translate units and use custom digit format inside ruler.
Declaration
Objective-C
- (void)setScaleRulerTextFormatterBlock: (nonnull GLMapScaleRulerTextFormatterBlock)block;Parameters
blockNew text formatter block
-
Last location received by
GLMapViewDeclaration
Objective-C
@property (atomic, readonly) CLLocation *_Nullable lastLocation; -
Defines if user location is displayed or not. If
YES, user location is displayed.Declaration
Objective-C
@property (nonatomic, assign, unsafe_unretained, readwrite) BOOL showUserLocation; -
Sets alternative user location images.
Declaration
Objective-C
- (void)setUserLocationImage:(UIImage *_Nullable)locationImage movementImage:(UIImage *_Nullable)movementImage;Parameters
locationImagenew user location image. If
nil, old image is left unchanged.movementImagenew user movement image. If
nil, old image is left unchanged.
-
Sets map style
Declaration
Objective-C
- (void)setStyle:(nonnull GLMapVectorCascadeStyle *)style;Parameters
styleStyle to set
-
Sets scale of font loaded frrom styleBundle. By default fontScale is 1.0
Declaration
Objective-C
- (void)setFontScale:(float)fontScale; -
Tile sources. By default mapView have no vector tile source.
Declaration
Objective-C
@property (atomic, copy, readwrite) NSArray<GLMapTileSource *> *_Nullable tileSources; -
Forces reloading of all tiles. Call this function after modifying map style with functions
loadStyle*Declaration
Objective-C
- (void)reloadTiles; -
Removes all tiles. Useful to reduce memory usage in background mode
Declaration
Objective-C
- (void)removeAllTiles;
-
Origin point of the map coordinate system (X, Y).
Changing the values in this property between 0 and 1 in relative coordinates describes the point of GLMapView which is considered as a center point for
mapCenterandsetMapCenter:animated:.Declaration
Objective-C
@property (atomic, assign, unsafe_unretained, readwrite) CGPoint mapOrigin; -
Coordinates of the origin point of the map.
See
mapOriginDeclaration
Objective-C
@property (atomic, assign, unsafe_unretained, readwrite) GLMapPoint mapCenter; -
Coordinates of the origin point of the map.
See
mapOriginDeclaration
Objective-C
@property (atomic, assign, unsafe_unretained, readwrite) GLMapGeoPoint mapGeoCenter; -
Current zoom of the map view.
Declaration
Objective-C
@property (atomic, assign, unsafe_unretained, readwrite) double mapZoom; -
Current zoom level of the map view.
Declaration
Objective-C
@property (atomic, assign, unsafe_unretained, readwrite) double mapZoomLevel; -
Maximum possible value of
mapZoom. Map won’t zoom closer.Declaration
Objective-C
@property (atomic, assign, unsafe_unretained, readwrite) double maxZoom; -
Map rotation angle form 0° to 360°.
Declaration
Objective-C
@property (atomic, assign, unsafe_unretained, readwrite) double mapAngle; -
Starts animation described in block.
Declaration
Objective-C
- (nonnull GLMapAnimation *)animate:(nonnull GLMapAnimationBlock)animations;Parameters
animationsBlock with animations. You could set animation params using block param.
-
Starts animation described in block.
Declaration
Objective-C
- (nonnull GLMapAnimation *)animate:(nonnull GLMapAnimationBlock)animations withCompletion: (GLMapAnimationCompletionBlock _Nullable)completion;Parameters
animationsBlock with animations. You could set animation params using block param.
completionCommpletion block. It’s called when animation ends or cancelled.
-
Starts animation
Declaration
Objective-C
- (void)startAnimation:(nonnull GLMapAnimation *)animation;Parameters
animationAnimation to start.
-
Cancels all map position, zoom and angle animations.
Declaration
Objective-C
- (void)cancelMapAnimations; -
Calculates map zoom to fit bbox in view with given size.
Warning
If bbox size is 0, returns +inf.Declaration
Objective-C
- (double)mapZoomForBBox:(GLMapBBox)bbox viewSize:(CGSize)size; -
Calculates map zoom to fit current view.
Warning
If bbox size is 0, returns +inf.Declaration
Objective-C
- (double)mapZoomForBBox:(GLMapBBox)bbox;
-
Converts a point on the screen to an internal map coordinate.
Declaration
Objective-C
- (GLMapPoint)makeMapPointFromDisplayPoint:(CGPoint)displayPoint;Parameters
displayPointThe point you want to convert.
Return Value
The internal map coordinate of the specified point.
-
Converts a distance between two points on the screen to an internal map coordinate at current map zoom.
Declaration
Objective-C
- (GLMapPoint)makeMapPointFromDisplayDelta:(CGPoint)displayDelta;Parameters
displayDeltaThe delta you want to convert.
Return Value
The delta in internal map coordinates.
-
Converts a distance between two points on the screen to an internal map coordinate.
Declaration
Objective-C
- (GLMapPoint)makeMapPointFromDisplayDelta:(CGPoint)displayDelta andMapZoom:(double)mapZoom;Parameters
displayDeltaThe delta you want to convert.
mapZoomZoom of map
Return Value
The delta in internal map coordinates.
-
Converts a geo point to the point on the screen.
Declaration
Objective-C
- (CGPoint)makeDisplayPointFromGeoPoint:(GLMapGeoPoint)geoPoint;Parameters
geoPointThe geo point you want to convert.
Return Value
Coresponding point on the screen.
-
Converts a point on the screen to the geo point.
Declaration
Objective-C
- (GLMapGeoPoint)makeGeoPointFromDisplayPoint:(CGPoint)displayPoint;Parameters
displayPointPoint on screen you want to convert.
Return Value
Coresponding geo point.
-
Converts an internal map coordinate to the point on the screen.
Declaration
Objective-C
- (CGPoint)makeDisplayPointFromMapPoint:(GLMapPoint)mapPoint;Parameters
mapPointThe map point you want to convert.
Return Value
Coresponding point on the screen.
-
Converts geo coordinates to the internal point.
Declaration
Objective-C
+ (GLMapPoint)makeMapPointFromGeoPoint:(GLMapGeoPoint)geoPoint;Parameters
geoPointGeo point you want to convert.
Return Value
Corresponding point in map coordinates.
-
Converts an internal point to geo coordinates.
Declaration
Objective-C
+ (GLMapGeoPoint)makeGeoPointFromMapPoint:(GLMapPoint)mapPoint;Parameters
mapPointPoint in map coordinates.
Return Value
Corresponding point in geo coordinates.
-
Converts distance in meters to pixels on the screen
Declaration
Objective-C
- (double)makePixelsFromMeters:(double)meters;Parameters
metersDistance in meters
Return Value
Distance in pixels
-
Converts distance in pixels on the screen to meters
Declaration
Objective-C
- (double)makeMetersFromPixels:(double)pixels;Parameters
pixelsDistance in pixels
Return Value
Distance in meters
-
Converts distance in meters to map coordinates
Declaration
Objective-C
- (double)makeInternalFromMeters:(double)meters;Parameters
metersDistance in meters
Return Value
Distance in map coordinates
-
Converts distance in map coordinates to meters
Declaration
Objective-C
- (double)makeMetersFromInternal:(double)internal;Parameters
internalDistance in map coordinates
Return Value
Distance in meters
-
Converts distance in pixels to map coordinates
Declaration
Objective-C
- (double)makeInternalFromPixels:(double)pixels;Parameters
pixelsDistance in pixels
Return Value
Distance in map coordinates
-
Converts distance in map coordinates to pixels
Declaration
Objective-C
- (double)makePixelsFromInternal:(double)internal;Parameters
internalDistance in map coordinates
Return Value
Distance in pixels
-
Adds the
GLMapDrawObjectto the map view.Declaration
Objective-C
- (void)add:(nonnull GLMapDrawObject *)drawObject;Parameters
drawObjectobject to add
-
Removes previsously added
GLMapDrawObjectfrom the map view.Declaration
Objective-C
- (void)remove:(nonnull GLMapDrawObject *)drawObject;Parameters
drawObjectobject to be removed.
-
Map locale settings
Set of supported locales is returned by
[GLMapLocaleSettings supportedLocales]E.g. to set map languages priority to English, Deutsch, native
[_mapView setLocaleSettings:[[GLMapLocaleSettings alloc] initWithLocalesOrder:@[@"en", @"de", @"native"]]]; // Then reload tiles to apply new locale settings [_mapView reloadTiles];Default value is supported languages from
[NSLocale preferredLanguages]Declaration
Objective-C
@property (atomic, strong, readwrite) GLMapLocaleSettings *_Nonnull localeSettings;
-
Returns object near some point on map
Declaration
Objective-C
- (GLMapVectorObject *_Nullable)mapObjectNearPoint:(GLMapPoint)point maxDistance:(double)maxDistance;Parameters
pointPoint on map
maxDistanceDistance in points
Return Value
Vector object on map
Install in Dash
GLMapView Class Reference