Class YMKMap

The object that is used to interact with the map.

Instance Methods

- addCameraListenerWithCameraListener:

Adds camera listeners.

- addInertiaMoveListenerWithInertiaMoveListener:

Adds inertia move listeners.

- addInputListenerWithInputListener:

Adds input listeners.

- addLayerWithLayerId:contentType:format:layerOptions:tileUrlProvider:imageUrlProvider:modelUrlProvider:styleUrlProvider:glyphUrlProvider:projection:zoomRanges:

Adds a vector layer which uses the network to load tiles from URLs obtained through UrlProvider, images, models, styles and glyphs obtained through their respective UrlProviders Sublayers will be added after corresponding sublayers of the map layer.

- addLayerWithLayerId:contentType:layerOptions:tileProvider:imageUrlProvider:animatedImageUrlProvider:projection:zoomRanges:

Adds a layer that displays tiles from the user-defined TileProvider.

- addLayerWithLayerId:contentType:layerOptions:tileProvider:imageUrlProvider:projection:

Adds a layer that displays tiles from the user-defined TileProvider.

- addLayerWithLayerId:contentType:layerOptions:tileUrlProvider:imageUrlProvider:modelUrlProvider:glyphUrlProvider:projection:zoomRanges:

Adds a vector layer which uses the network to load tiles from URLs obtained through UrlProvider, images, models and glyphs obtained through their respective UrlProviders Sublayers will be added after corresponding sublayers of the map layer.

- addLayerWithLayerId:contentType:layerOptions:tileUrlProvider:imageUrlProvider:projection:

Adds a layer that uses the network to load tiles from URLs obtained through UrlProvider.

- addMapObjectLayerWithLayerId:

Creates a new independent map object collection linked to the specified layer ID.

- addTapListenerWithTapListener:

Adds a tap listener that is used to obtain brief geo object info.

- cameraPositionWithBoundingBox:

Calculates the camera position that projects the specified area into the view.

- deselectGeoObject

Resets the currently selected geo object.

- getMaxZoom

Maximum available zoom level.

- getMinZoom

Minimum available zoom level.

- moveWithCameraPosition:

Immediately changes the camera position.

- moveWithCameraPosition:animationType:cameraCallback:

Changes camera position.

- removeCameraListenerWithCameraListener:

Removes camera listeners.

- removeInertiaMoveListenerWithInertiaMoveListener:

Removes inertia move listeners.

- removeInputListenerWithInputListener:

Removes input listeners.

- removeTapListenerWithTapListener:

Removes a tap listener that is used to obtain brief geo object info.

- resetMapStyles

Resets all JSON style transformations applied to the map.

- selectGeoObjectWithObjectId:layerId:

Selects a geo object with the specified objectId in the specified layerId.

- set2DModeWithEnable:

Forces the map to be flat.

- setMapLoadedListenerWithMapLoadedListener:

Sets a map loaded listener.

- setMapStyleWithId:style:

Applies JSON style transformations to the map.

- setMapStyleWithStyle:

Applies JSON style transformations to the map.

- setTiltFunctionWithPoints:

Sets piecewise linear tilt depending on the zoom.

- visibleRegionWithCameraPosition:

Properties

cameraPosition
fastTapEnabled

Removes the 300 ms delay in emitting a tap gesture.

layerIconSet

The icon set provides an interface for adding custom icons to be used in layer customization.

logo

Yandex logo object.

mapObjects
mapType

Sets the base map type.

modelsEnabled

Enables/disables detailed 3D models on the map.

nightModeEnabled

If enabled, night mode will reduce map brightness and improve contrast.

rotateGesturesEnabled

Enable/disable rotation gestures, such as rotation with two fingers.

scrollGesturesEnabled

Enable/disable scroll gestures, such as the pan gesture.

sublayerManager

Manages the collection of sublayers that define the drawing order.

tiltGesturesEnabled

Enable/disable tilt gestures, such as parallel pan with two fingers.

valid

Tells if this object is valid or no.

visibleRegion
zoomGesturesEnabled

Enable/disable zoom gestures, for example: - pinch - double tap (zoom in) - tap with two fingers (zoom out)

Method Detail

-addCameraListenerWithCameraListener:

- (void)addCameraListenerWithCameraListener:(nonnull id< YMKMapCameraListener >)cameraListener 

Adds camera listeners.

-addInertiaMoveListenerWithInertiaMoveListener:

- (void)addInertiaMoveListenerWithInertiaMoveListener:(nonnull id< YMKInertiaMoveListener >)inertiaMoveListener 

Adds inertia move listeners.

-addInputListenerWithInputListener:

- (void)addInputListenerWithInputListener:(nonnull id< YMKMapInputListener >)inputListener 

Adds input listeners.

-addLayerWithLayerId:contentType:format:layerOptions:tileUrlProvider:imageUrlProvider:modelUrlProvider:styleUrlProvider:glyphUrlProvider:projection:zoomRanges:

- (nonnull YMKLayer *)addLayerWithLayerId:(nonnull NSString *)layerId
                              contentType:(nonnull NSString *)contentType
                                   format:(YMKTileFormat)format
                             layerOptions:(nonnull YMKLayerOptions *)layerOptions
                          tileUrlProvider:(nonnull id< YMKTilesUrlProvider >)tileUrlProvider
                         imageUrlProvider:(nonnull id< YMKResourceUrlProvider >)imageUrlProvider
                         modelUrlProvider:(nonnull id< YMKResourceUrlProvider >)modelUrlProvider
                         styleUrlProvider:(nonnull id< YMKResourceUrlProvider >)styleUrlProvider
                         glyphUrlProvider:(nonnull id< YMKGlyphsGlyphUrlProvider >)glyphUrlProvider
                               projection:(nonnull id< YMKProjection >)projection
                               zoomRanges:(nonnull NSArray< YMKZoomRange * > *)zoomRanges 

Adds a vector layer which uses the network to load tiles from URLs obtained through UrlProvider, images, models, styles and glyphs obtained through their respective UrlProviders Sublayers will be added after corresponding sublayers of the map layer.

-addLayerWithLayerId:contentType:layerOptions:tileProvider:imageUrlProvider:animatedImageUrlProvider:projection:zoomRanges:

- (nonnull YMKLayer *)addLayerWithLayerId:(nonnull NSString *)layerId
                              contentType:(nonnull NSString *)contentType
                             layerOptions:(nonnull YMKLayerOptions *)layerOptions
                             tileProvider:(nonnull id< YMKTileProvider >)tileProvider
                         imageUrlProvider:(nonnull id< YMKResourceUrlProvider >)imageUrlProvider
                 animatedImageUrlProvider:(nonnull id< YMKResourceUrlProvider >)animatedImageUrlProvider
                               projection:(nonnull id< YMKProjection >)projection
                               zoomRanges:(nonnull NSArray< YMKZoomRange * > *)zoomRanges 

Adds a layer that displays tiles from the user-defined TileProvider.

Sublayers will be added after corresponding sublayers of the map layer.

-addLayerWithLayerId:contentType:layerOptions:tileProvider:imageUrlProvider:projection:

- (nonnull YMKLayer *)addLayerWithLayerId:(nonnull NSString *)layerId
                              contentType:(nonnull NSString *)contentType
                             layerOptions:(nonnull YMKLayerOptions *)layerOptions
                             tileProvider:(nonnull id< YMKTileProvider >)tileProvider
                         imageUrlProvider:(nonnull id< YMKResourceUrlProvider >)imageUrlProvider
                               projection:(nonnull id< YMKProjection >)projection 

Adds a layer that displays tiles from the user-defined TileProvider.

Sublayers will be added after corresponding sublayers of the map layer.

-addLayerWithLayerId:contentType:layerOptions:tileUrlProvider:imageUrlProvider:modelUrlProvider:glyphUrlProvider:projection:zoomRanges:

- (nonnull YMKLayer *)addLayerWithLayerId:(nonnull NSString *)layerId
                              contentType:(nonnull NSString *)contentType
                             layerOptions:(nonnull YMKLayerOptions *)layerOptions
                          tileUrlProvider:(nonnull id< YMKTilesUrlProvider >)tileUrlProvider
                         imageUrlProvider:(nonnull id< YMKResourceUrlProvider >)imageUrlProvider
                         modelUrlProvider:(nonnull id< YMKResourceUrlProvider >)modelUrlProvider
                         glyphUrlProvider:(nonnull id< YMKGlyphsGlyphUrlProvider >)glyphUrlProvider
                               projection:(nonnull id< YMKProjection >)projection
                               zoomRanges:(nonnull NSArray< YMKZoomRange * > *)zoomRanges 

Adds a vector layer which uses the network to load tiles from URLs obtained through UrlProvider, images, models and glyphs obtained through their respective UrlProviders Sublayers will be added after corresponding sublayers of the map layer.

-addLayerWithLayerId:contentType:layerOptions:tileUrlProvider:imageUrlProvider:projection:

- (nonnull YMKLayer *)addLayerWithLayerId:(nonnull NSString *)layerId
                              contentType:(nonnull NSString *)contentType
                             layerOptions:(nonnull YMKLayerOptions *)layerOptions
                          tileUrlProvider:(nonnull id< YMKTilesUrlProvider >)tileUrlProvider
                         imageUrlProvider:(nonnull id< YMKResourceUrlProvider >)imageUrlProvider
                               projection:(nonnull id< YMKProjection >)projection 

Adds a layer that uses the network to load tiles from URLs obtained through UrlProvider.

Sublayers will be added after corresponding sublayers of the map layer.
Parameters:
layerId

The id of the layer.

contentType

Layer content type.

layerOptions

Layer options.

tileUrlProvider

Tile URL provider.

imageUrlProvider

Image URL provider.

projection

Projection.

-addMapObjectLayerWithLayerId:

- (nonnull YMKMapObjectCollection *)addMapObjectLayerWithLayerId:(nonnull NSString *)layerId 

Creates a new independent map object collection linked to the specified layer ID.

Sublayers will be added after corresponding sublayers of the topmost layer.

-addTapListenerWithTapListener:

- (void)addTapListenerWithTapListener:(nonnull id< YMKLayersGeoObjectTapListener >)tapListener 

Adds a tap listener that is used to obtain brief geo object info.

-cameraPositionWithBoundingBox:

- (nonnull YMKCameraPosition *)cameraPositionWithBoundingBox:(nonnull YMKBoundingBox *)boundingBox 

Calculates the camera position that projects the specified area into the view.

-deselectGeoObject

- (void)deselectGeoObject

Resets the currently selected geo object.

-getMaxZoom

- (float)getMaxZoom

Maximum available zoom level.

-getMinZoom

- (float)getMinZoom

Minimum available zoom level.

-moveWithCameraPosition:

- (void)moveWithCameraPosition:(nonnull YMKCameraPosition *)cameraPosition 

Immediately changes the camera position.

Can cancel a previous unfinished movement.

-moveWithCameraPosition:animationType:cameraCallback:

- (void)moveWithCameraPosition:(nonnull YMKCameraPosition *)cameraPosition
                 animationType:(nonnull YMKAnimation *)animationType
                cameraCallback:(nullable YMKMapCameraCallback)cameraCallback 

Changes camera position.

Can cancel a previous unfinished movement.
Parameters:
animationType

Required. Defines animation parameters. Deferred teleportation can be achieved via Animation::Step with the necessary duration. Animation for more details.

cameraCallback

A function that takes the bool argument marking the camera action complete. Invoked when: 1) A camera action is cancelled (for example, as a result of a subsequent request for camera movement), passing false as an argument. 2) A camera action finished successfully, passing true as an argument.

Remark:
Parameters:
cameraCallback

has optional type, it may be uninitialized.

-removeCameraListenerWithCameraListener:

- (void)removeCameraListenerWithCameraListener:(nonnull id< YMKMapCameraListener >)cameraListener 

Removes camera listeners.

-removeInertiaMoveListenerWithInertiaMoveListener:

- (void)removeInertiaMoveListenerWithInertiaMoveListener:(nonnull id< YMKInertiaMoveListener >)inertiaMoveListener 

Removes inertia move listeners.

-removeInputListenerWithInputListener:

- (void)removeInputListenerWithInputListener:(nonnull id< YMKMapInputListener >)inputListener 

Removes input listeners.

-removeTapListenerWithTapListener:

- (void)removeTapListenerWithTapListener:(nonnull id< YMKLayersGeoObjectTapListener >)tapListener 

Removes a tap listener that is used to obtain brief geo object info.

-resetMapStyles

- (void)resetMapStyles

Resets all JSON style transformations applied to the map.

-selectGeoObjectWithObjectId:layerId:

- (void)selectGeoObjectWithObjectId:(nonnull NSString *)objectId
                            layerId:(nonnull NSString *)layerId 

Selects a geo object with the specified objectId in the specified layerId.

If the object is not currently on the screen, it is selected anyway, but the user will not actually see that. You need to move the camera in addition to this call to be sure that the selected object is visible for the user. Both objectId and layerId can be extracted from the geo object's metadata container by using geo_object_selection_metadata when the user taps on a geo object.

-set2DModeWithEnable:

- (void)set2DModeWithEnable:(BOOL)enable 

Forces the map to be flat.

true - All loaded tiles start showing the "flatten out" animation; all new tiles do not start 3D animation. false - All tiles start showing the "rise up" animation.

-setMapLoadedListenerWithMapLoadedListener:

- (void)setMapLoadedListenerWithMapLoadedListener:(nullable id< YMKMapLoadedListener >)mapLoadedListener 

Sets a map loaded listener.

Remark:
Parameters:
mapLoadedListener

has optional type, it may be uninitialized.

-setMapStyleWithId:style:

- (BOOL)setMapStyleWithId:(NSInteger)id
                    style:(nonnull NSString *)style 

Applies JSON style transformations to the map.

Replaces previous styling with the specified ID (if such exists). Stylings are applied in an ascending order. Affects VectorMap and Hybrid map types. Set to empty string to clear previous styling with the specified ID. Returns true if the style was successfully parsed, and false otherwise. If the returned value is false, the current map style remains unchanged.

-setMapStyleWithStyle:

- (BOOL)setMapStyleWithStyle:(nonnull NSString *)style 

Applies JSON style transformations to the map.

Same as setMapStyle(0, style). Affects VectorMap and Hybrid map types. Set to empty string to clear previous styling. Returns true if the style was successfully parsed, and false otherwise. If the returned value is false, the current map style remains unchanged.

-setTiltFunctionWithPoints:

- (void)setTiltFunctionWithPoints:(nonnull NSArray< NSValue * > *)points 

Sets piecewise linear tilt depending on the zoom.

'points' must be sorted by x; x coordinates must be unique. If zoom < minZoom(points) or zoom > maxZoom(points), it is set within the defined bounds before applying the function. If points is null or points.empty() it erases the previously set function. If points.size() == 1, tilt is constant and equals point.y.

-visibleRegionWithCameraPosition:

- (nonnull YMKVisibleRegion *)visibleRegionWithCameraPosition:(nonnull YMKCameraPosition *)cameraPosition 

Returns:

The map region that is visible from the given camera position. Region IS bounded by latitude limits [-90, 90] and IS NOT bounded by longitude limits [-180, 180]. If the longitude exceeds its limits, we see the world's edge and another instance of the world beyond this edge.

Property Detail

cameraPosition

(assign, readonly) YMKCameraPosition * cameraPosition

Returns:

Current camera position. Target position must be within latitude [-90, 90] and longitude [-180, 180].

fastTapEnabled

(assign, readwrite, getter=isFastTapEnabled) BOOL fastTapEnabled

Removes the 300 ms delay in emitting a tap gesture.

However, a double-tap will emit a tap gesture along with a double-tap.

layerIconSet

(assign, readonly) YMKIconSet * layerIconSet

The icon set provides an interface for adding custom icons to be used in layer customization.

Affects VectorMap and Hybrid map types.

mapObjects

(assign, readonly) YMKMapObjectCollection * mapObjects

Returns:

List of map objects associated with the map.

mapType

(assign, readwrite) YMKMapType mapType

Sets the base map type.

modelsEnabled

(assign, readwrite, getter=isModelsEnabled) BOOL modelsEnabled

Enables/disables detailed 3D models on the map.

Enabled by default.

nightModeEnabled

(assign, readwrite, getter=isNightModeEnabled) BOOL nightModeEnabled

If enabled, night mode will reduce map brightness and improve contrast.

rotateGesturesEnabled

(assign, readwrite, getter=isRotateGesturesEnabled) BOOL rotateGesturesEnabled

Enable/disable rotation gestures, such as rotation with two fingers.

scrollGesturesEnabled

(assign, readwrite, getter=isScrollGesturesEnabled) BOOL scrollGesturesEnabled

Enable/disable scroll gestures, such as the pan gesture.

sublayerManager

(assign, readonly) YMKSublayerManager * sublayerManager

Manages the collection of sublayers that define the drawing order.

tiltGesturesEnabled

(assign, readwrite, getter=isTiltGesturesEnabled) BOOL tiltGesturesEnabled

Enable/disable tilt gestures, such as parallel pan with two fingers.

valid

(assign, readonly, getter=isValid) BOOL valid

Tells if this object is valid or no.

Any method called on an invalid object will throw an exception. The object becomes invalid only on UI thread, and only when its implementation depends on objects already destroyed by now. Please refer to general docs about the interface for details on its invalidation.

visibleRegion

(assign, readonly) YMKVisibleRegion * visibleRegion

Returns:

The map region that is currently visible. Region IS bounded by latitude limits [-90, 90] and IS NOT bounded by longitude limits [-180, 180]. If the longitude exceeds its limits, we see the world's edge and another instance of the world beyond this edge.

zoomGesturesEnabled

(assign, readwrite, getter=isZoomGesturesEnabled) BOOL zoomGesturesEnabled

Enable/disable zoom gestures, for example: - pinch - double tap (zoom in) - tap with two fingers (zoom out)