Class YMKMap

The object that is used to interact with the map.

Instance Methods

- addCameraListenerWithCameraListener:

Manages camera listeners.

- addInputListenerWithInputListener:

Manages input listeners.

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

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

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

Adds a vector layer which uses the network to load tiles from URLs obtained through UrlProvider, images and glyphs obtained through their respective UrlProviders.

- addLayerWithLayerId:contentType:layerOptions:urlProvider:imageUrlProvider:projection:

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

- addTapListenerWithTapListener:

Adds/removes 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:
- removeInputListenerWithInputListener:
- removeTapListenerWithTapListener:
- 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.

- setMapStyleWithStyle:

Applies JSON style transformations to the map.

- setTiltFunctionWithPoints:

Sets piecewise linear tilt depending on the zoom.

- visibleRegionWithCameraPosition:
- addCameraListenerWithCameraListener:

Manages camera listeners.

- addInputListenerWithInputListener:

Manages input listeners.

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

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

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

Adds a vector layer which uses the network to load tiles from URLs obtained through UrlProvider, images and glyphs obtained through their respective UrlProviders.

- addLayerWithLayerId:contentType:layerOptions:urlProvider:imageUrlProvider:projection:

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

- addTapListenerWithTapListener:

Adds/removes 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:
- removeInputListenerWithInputListener:
- removeTapListenerWithTapListener:
- 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.

- setMapStyleWithStyle:

Applies JSON style transformations to the map.

- setTiltFunctionWithPoints:

Sets piecewise linear tilt depending on the zoom.

- visibleRegionWithCameraPosition:

Properties

cameraPosition
carparksEventsLayer

Gets the carparks events layer.

carparksLayer

Gets the carparks layer.

carparksNearbyLayer

Gets the nearby carparks layer.

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.

pointCloudLayer

Gets the search layer.

rotateGesturesEnabled

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

scrollGesturesEnabled

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

searchLayer

Gets the search_layer object.

tiltGesturesEnabled

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

trafficLayer

Gets the traffic layer.

userLocationLayer

Layer with the user location icon.

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)

cameraPosition
carparksEventsLayer

Gets the carparks events layer.

carparksLayer

Gets the carparks layer.

carparksNearbyLayer

Gets the nearby carparks layer.

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.

pointCloudLayer

Gets the search layer.

rotateGesturesEnabled

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

scrollGesturesEnabled

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

searchLayer

Gets the search_layer object.

tiltGesturesEnabled

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

trafficLayer

Gets the traffic layer.

userLocationLayer

Layer with the user location icon.

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:(nullable id< YMKMapCameraListener >)cameraListener 

Manages camera listeners.

-addInputListenerWithInputListener:

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

Manages input listeners.

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

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

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

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

- (nullable YMKLayer *)addLayerWithLayerId:(nonnull NSString *)layerId
                               contentType:(nonnull NSString *)contentType
                              layerOptions:(nonnull YMKLayerOptions *)layerOptions
                          tilesUrlProvider:(nullable id< YMKTilesUrlProvider >)tilesUrlProvider
                          imageUrlProvider:(nullable id< YMKResourceUrlProvider >)imageUrlProvider
                          modelUrlProvider:(nullable id< YMKResourceUrlProvider >)modelUrlProvider
                          glyphUrlProvider:(nullable id< YMKGlyphsGlyphUrlProvider >)glyphUrlProvider
                                projection:(nullable 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 and glyphs obtained through their respective UrlProviders.

-addLayerWithLayerId:contentType:layerOptions:urlProvider:imageUrlProvider:projection:

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

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

-addTapListenerWithTapListener:

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

Adds/removes 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.

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.

-removeCameraListenerWithCameraListener:

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

-removeInputListenerWithInputListener:

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

-removeTapListenerWithTapListener:

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

-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 flatten out animation; all new tiles do not start 3D animation. false - all tiles start grow up animation.

-setMapLoadedListenerWithMapLoadedListener:

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

Sets a map loaded listener.

-setMapStyleWithStyle:

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

Applies JSON style transformations to the map.

Affects VectorMap and Hybrid map types. Set to null to clear any previous custom 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].

carparksEventsLayer

(assign, readonly) YMKCarparksEventsLayer * carparksEventsLayer

Gets the carparks events layer.

carparksLayer

(assign, readonly) YMKCarparksLayer * carparksLayer

Gets the carparks layer.

carparksNearbyLayer

(assign, readonly) YMKCarparksNearbyLayer * carparksNearbyLayer

Gets the nearby carparks layer.

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.

pointCloudLayer

(assign, readonly) YMKPointCloudLayer * pointCloudLayer

Gets the search layer.

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.

searchLayer

(assign, readonly) YMKSearchLayer * searchLayer

Gets the search_layer object.

tiltGesturesEnabled

(assign, readwrite, getter=isTiltGesturesEnabled) BOOL tiltGesturesEnabled

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

trafficLayer

(assign, readonly) YMKTrafficLayer * trafficLayer

Gets the traffic layer.

userLocationLayer

(assign, readonly) YMKUserLocationLayer * userLocationLayer

Layer with the user location icon.

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)