-
Get the URI of the current Mapbox Style in use.
Declaration
Objective-C
- (nonnull NSString *)getStyleURI;
Swift
func getStyleURI() -> String
Return Value
A string containing a Mapbox style URI.
-
Load style from provided URI.
This is an asynchronous call. To check the result of this operation the user must register an observer observing “map-loaded” or “map-loading-error” events. In case of successful style load, “style-loaded” event will be also emitted.
\attention This method should be called on the same thread where - see: StyleManager object is initialized.
Declaration
Objective-C
- (void)setStyleURIForUri:(nonnull NSString *)uri;
Swift
func setStyleURIForUri(_ uri: String)
Parameters
uri
URI where the style should be loaded from.
-
Get the JSON serialization string of the current Mapbox Style in use.
Declaration
Objective-C
- (nonnull NSString *)getStyleJSON;
Swift
func getStyleJSON() -> String
Return Value
A JSON string containing a serialized Mapbox Style.
-
Load the style from a provided JSON string.
\attention This method should be called on the same thread where - see: Map object is initialized.
Declaration
Objective-C
- (void)setStyleJSONForJson:(nonnull NSString *)json;
Swift
func setStyleJSONForJson(_ json: String)
Parameters
json
A JSON string containing a serialized Mapbox Style.
-
Returns the map style’s default camera, if any, or a default camera otherwise. The map style default camera is defined as follows:
- center: https://docs.mapbox.com/mapbox-gl-js/style-spec/#root-center
- zoom: https://docs.mapbox.com/mapbox-gl-js/style-spec/#root-zoom
- bearing: https://docs.mapbox.com/mapbox-gl-js/style-spec/#root-bearing
- pitch: https://docs.mapbox.com/mapbox-gl-js/style-spec/#root-pitch
The style default camera is re-evaluated when a new style is loaded.
Declaration
Objective-C
- (nonnull MBMCameraOptions *)getStyleDefaultCamera;
Swift
func getStyleDefaultCamera() -> MBMCameraOptions
Return Value
Returns the map style default camera.
-
Returns the map style’s transition options. By default, the style parser will attempt to read the style default transition options, if any, fallbacking to an immediate transition otherwise. Transition options can be overriden via setStyleTransition, but the options are reset once a new style has been loaded.
The style transition is re-evaluated when a new style is loaded.
Declaration
Objective-C
- (nonnull MBMTransitionOptions *)getStyleTransition;
Swift
func getStyleTransition() -> MBMTransitionOptions
Return Value
Returns the map style transition options.
-
Overrides the map style’s transition options with user-provided options.
The style transition is re-evaluated when a new style is loaded.
Declaration
Objective-C
- (void)setStyleTransitionForTransitionOptions: (nonnull MBMTransitionOptions *)transitionOptions;
Swift
func setStyleTransitionFor(_ transitionOptions: MBMTransitionOptions)
Parameters
transitionOptions
Map style transition options.
-
Checks whether a given style layer exists.
Runtime style layers are valid until they are either removed or a new style is loaded.
Declaration
Objective-C
- (BOOL)styleLayerExistsForLayerId:(nonnull NSString *)layerId;
Swift
func styleLayerExists(forLayerId layerId: String) -> Bool
Parameters
layerId
Style layer identifier.
Return Value
True if the given style layer exists, false otherwise.
-
Returns the existing style layers.
Declaration
Objective-C
- (nonnull NSArray<MBMStyleObjectInfo *> *)getStyleLayers;
Swift
func getStyleLayers() -> [MBMStyleObjectInfo]
Return Value
The list containing the information about existing style layer objects.
-
Gets the value of style layer \p property.
Declaration
Objective-C
- (nonnull MBMStylePropertyValue *) getStyleLayerPropertyForLayerId:(nonnull NSString *)layerId property:(nonnull NSString *)property;
Swift
func getStyleLayerProperty(forLayerId layerId: String, property: String) -> MBMStylePropertyValue
Parameters
layerId
Style layer identified.
property
Style layer property name.
Return Value
The value of \p property in the layer with \p layerId.
-
Gets the default value of style layer \p property.
Declaration
Objective-C
+ (nonnull MBMStylePropertyValue *) getStyleLayerPropertyDefaultValueForLayerType:(nonnull NSString *)layerType property:(nonnull NSString *)property;
Swift
class func getStyleLayerPropertyDefaultValue(forLayerType layerType: String, property: String) -> MBMStylePropertyValue
Parameters
layerType
Style layer type.
property
Style layer property name.
Return Value
The default value of \p property for the layers with type \p layerType.
-
Gets the value of style source \p property.
Declaration
Objective-C
- (nonnull MBMStylePropertyValue *) getStyleSourcePropertyForSourceId:(nonnull NSString *)sourceId property:(nonnull NSString *)property;
Swift
func getStyleSourceProperty(forSourceId sourceId: String, property: String) -> MBMStylePropertyValue
Parameters
sourceId
Style source identified.
property
Style source property name.
Return Value
The value of \p property in the source with \p sourceId.
-
Gets the default value of style source \p property.
Declaration
Objective-C
+ (nonnull MBMStylePropertyValue *) getStyleSourcePropertyDefaultValueForSourceType: (nonnull NSString *)sourceType property: (nonnull NSString *)property;
Swift
class func getStyleSourcePropertyDefaultValue(forSourceType sourceType: String, property: String) -> MBMStylePropertyValue
Parameters
sourceType
Style source type.
property
Style source property name.
Return Value
The default value of \p property for the sources with type \p sourceType.
-
Checks whether a given style source exists.
Declaration
Objective-C
- (BOOL)styleSourceExistsForSourceId:(nonnull NSString *)sourceId;
Swift
func styleSourceExists(forSourceId sourceId: String) -> Bool
Parameters
sourceId
Style source identifier.
Return Value
True if the given source exists, false otherwise.
-
Returns the existing style sources.
Declaration
Objective-C
- (nonnull NSArray<MBMStyleObjectInfo *> *)getStyleSources;
Swift
func getStyleSources() -> [MBMStyleObjectInfo]
Return Value
The list containing the information about existing style source objects.
-
Gets the value of a style light \a property.
Declaration
Objective-C
- (nonnull MBMStylePropertyValue *)getStyleLightPropertyForProperty: (nonnull NSString *)property;
Swift
func getStyleLightProperty(forProperty property: String) -> MBMStylePropertyValue
Parameters
property
Style light property name.
Return Value
Style light property value.
-
Gets the value of a style terrain \a property.
Declaration
Objective-C
- (nonnull MBMStylePropertyValue *)getStyleTerrainPropertyForProperty: (nonnull NSString *)property;
Swift
func getStyleTerrainProperty(forProperty property: String) -> MBMStylePropertyValue
Parameters
property
Style terrain property name.
Return Value
Style terrain property value.
-
Get an image from the style.
Declaration
Objective-C
- (nullable MBMImage *)getStyleImageForImageId:(nonnull NSString *)imageId;
Swift
func getStyleImage(forImageId imageId: String) -> MBMImage?
Parameters
imageId
ID of the image.
Return Value
Image data associated with the given ID, or empty if no image is associated with that ID.
-
Check if the style is completely loaded.
Note: The style specified sprite would be marked as loaded even with sprite loading error (An error will be emitted via \link MapEvents: MapLoadingError \endlink). Sprite loading error is not fatal and we don’t want it to block the map rendering, thus the function will still return TRUE if style and sources are fully loaded.
Declaration
Objective-C
- (BOOL)isStyleLoaded;
Swift
func isStyleLoaded() -> Bool
Return Value
TRUE if and only if the style JSON contents, the style specified sprite and sources are all loaded, otherwise returns FALSE.
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)addStyleLayerForProperties:(nonnull id)properties layerPosition:(nullable MBMLayerPosition *)layerPosition __attribute((ns_returns_retained));
Swift
func addStyleLayer(forProperties properties: Any, layerPosition: MBMLayerPosition?) -> MBXExpected
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)addStyleCustomLayerForLayerId:(nonnull NSString *)layerId layerHost:(nonnull id<MBMCustomLayerHost>)layerHost layerPosition:(nullable MBMLayerPosition *)layerPosition __attribute((ns_returns_retained));
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)removeStyleLayerForLayerId:(nonnull NSString *)layerId __attribute((ns_returns_retained));
Swift
func removeStyleLayer(forLayerId layerId: String) -> MBXExpected
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)setStyleLayerPropertyForLayerId:(nonnull NSString *)layerId property:(nonnull NSString *)property value:(nonnull id)value __attribute((ns_returns_retained));
Swift
func setStyleLayerPropertyForLayerId(_ layerId: String, property: String, value: Any) -> MBXExpected
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)getStyleLayerPropertiesForLayerId:(nonnull NSString *)layerId __attribute((ns_returns_retained));
Swift
func getStyleLayerProperties(forLayerId layerId: String) -> MBXExpected
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)setStyleLayerPropertiesForLayerId:(nonnull NSString *)layerId properties:(nonnull id)properties __attribute((ns_returns_retained));
Swift
func setStyleLayerPropertiesForLayerId(_ layerId: String, properties: Any) -> MBXExpected
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)addStyleSourceForSourceId:(nonnull NSString *)sourceId properties:(nonnull id)properties __attribute((ns_returns_retained));
Swift
func addStyleSource(forSourceId sourceId: String, properties: Any) -> MBXExpected
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)setStyleSourcePropertyForSourceId:(nonnull NSString *)sourceId property:(nonnull NSString *)property value:(nonnull id)value __attribute((ns_returns_retained));
Swift
func setStyleSourcePropertyForSourceId(_ sourceId: String, property: String, value: Any) -> MBXExpected
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)getStyleSourcePropertiesForSourceId:(nonnull NSString *)sourceId __attribute((ns_returns_retained));
Swift
func getStyleSourceProperties(forSourceId sourceId: String) -> MBXExpected
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)setStyleSourcePropertiesForSourceId:(nonnull NSString *)sourceId properties:(nonnull id)properties __attribute((ns_returns_retained));
Swift
func setStyleSourcePropertiesForSourceId(_ sourceId: String, properties: Any) -> MBXExpected
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)removeStyleSourceForSourceId:(nonnull NSString *)sourceId __attribute((ns_returns_retained));
Swift
func removeStyleSource(forSourceId sourceId: String) -> MBXExpected
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)setStyleLightForProperties:(nonnull id)properties __attribute((ns_returns_retained));
Swift
func setStyleLightForProperties(_ properties: Any) -> MBXExpected
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)setStyleLightPropertyForProperty:(nonnull NSString *)property value:(nonnull id)value __attribute((ns_returns_retained));
Swift
func setStyleLightPropertyForProperty(_ property: String, value: Any) -> MBXExpected
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)setStyleTerrainForProperties:(nonnull id)properties __attribute((ns_returns_retained));
Swift
func setStyleTerrainForProperties(_ properties: Any) -> MBXExpected
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)setStyleTerrainPropertyForProperty:(nonnull NSString *)property value:(nonnull id)value __attribute((ns_returns_retained));
Swift
func setStyleTerrainPropertyForProperty(_ property: String, value: Any) -> MBXExpected
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)addStyleImageForImageId:(nonnull NSString *)imageId scale:(float)scale image:(nonnull MBMImage *)image sdf:(BOOL)sdf stretchX:(nonnull NSArray<MBMImageStretches *> *)stretchX stretchY:(nonnull NSArray<MBMImageStretches *> *)stretchY content:(nullable MBMImageContent *)content __attribute((ns_returns_retained));
Swift
func addStyleImage(forImageId imageId: String, scale: Float, image: MBMImage, sdf: Bool, stretchX: [MBMImageStretches], stretchY: [MBMImageStretches], content: MBMImageContent?) -> MBXExpected
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)removeStyleImageForImageId:(nonnull NSString *)imageId __attribute((ns_returns_retained));
Swift
func removeStyleImage(forImageId imageId: String) -> MBXExpected
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)addStyleCustomGeometrySourceForSourceId:(nonnull NSString *)sourceId options:(nonnull MBMCustomGeometrySourceOptions *)options __attribute((ns_returns_retained));
Swift
func addStyleCustomGeometrySource(forSourceId sourceId: String, options: MBMCustomGeometrySourceOptions) -> MBXExpected
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)setStyleCustomGeometrySourceTileDataForSourceId:(nonnull NSString *)sourceId tileId:(nonnull MBMCanonicalTileID *)tileId featureCollection:(nonnull NSArray<MBXFeature *> *)featureCollection __attribute((ns_returns_retained));
Swift
func setStyleCustomGeometrySourceTileDataForSourceId(_ sourceId: String, tileId: MBMCanonicalTileID, featureCollection: [MBXFeature]) -> MBXExpected
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)invalidateStyleCustomGeometrySourceTileForSourceId:(nonnull NSString *)sourceId tileId:(nonnull MBMCanonicalTileID *)tileId __attribute((ns_returns_retained));
Swift
func invalidateStyleCustomGeometrySourceTile(forSourceId sourceId: String, tileId: MBMCanonicalTileID) -> MBXExpected
-
Undocumented
Declaration
Objective-C
- (nonnull MBXExpected *)invalidateStyleCustomGeometrySourceRegionForSourceId:(nonnull NSString *)sourceId bounds:(nonnull MBMCoordinateBounds *)bounds __attribute((ns_returns_retained));
Swift
func invalidateStyleCustomGeometrySourceRegion(forSourceId sourceId: String, bounds: MBMCoordinateBounds) -> MBXExpected