getRouteShields

fun getRouteShields(bannerComponents: List<BannerComponents>?, callback: RouteShieldCallback)

Given a list of BannerComponents the function requests mapbox legacy road shields (if available) using BannerComponents.imageBaseUrl.

If you do not wish to download all of the shields at once, make sure to pass in only a list of banner components for which you'd like download the road shields.

The function is safe to be called repeatably, all the results are cached in-memory and requests are managed to avoid duplicating network bandwidth usage.

The function returns list of RouteShieldResult or RouteShieldError in RouteShieldCallback.onRoadShields.

To convert the returned in RouteShield SVG ByteArray to a Bitmap use toBitmap.

See also

toBitmap

Parameters

bannerComponents

list of banner components

callback

invoked with appropriate result

fun getRouteShields(bannerComponents: List<BannerComponents>?, userId: String?, styleId: String?, accessToken: String?, callback: RouteShieldCallback)

Given a list of BannerComponents the function requests mapbox designed road shields (if available) using BannerComponents.mapboxShield. If for any reason the API is unable to download the shield, it falls back to download and return the legacy shield if available. Returns error otherwise.

If you do not wish to download all of the shields at once, make sure to pass in only a list of banner components for which you'd like download the road shields.

The function is safe to be called repeatably, all the results are cached in-memory and requests are managed to avoid duplicating network bandwidth usage.

The function returns list of RouteShieldResult or RouteShieldError in RouteShieldCallback.onRoadShields.

To convert the returned in RouteShield SVG ByteArray to a Bitmap use toBitmap.

See also

toBitmap

Parameters

bannerComponents

list of banner components

userId

Mapbox user account name

styleId

style id used to render the map

accessToken

public access token

callback

invoked with appropriate result

fun getRouteShields(road: Road, callback: RouteShieldCallback)

Given a Road object, the function requests mapbox legacy road shields (if available) using Road.shieldUrl for the current road.

The function returns list of RouteShieldResult or RouteShieldError in RouteShieldCallback.onRoadShields.

To convert the returned in RouteShield SVG ByteArray to a Bitmap use toBitmap.

See also

toBitmap

Parameters

road

object representing current road

callback

invoked with appropriate result

fun getRouteShields(road: Road, userId: String?, styleId: String?, accessToken: String?, callback: RouteShieldCallback)

Given a Road object, the function requests mapbox designed road shields (if available) using Road.mapboxShield for the current road. If for any reason the API is unable to download the shield, it falls back to download and return the legacy shield if available. Returns error otherwise.

The function returns list of RouteShieldResult or RouteShieldError in RouteShieldCallback.onRoadShields.

To convert the returned in RouteShield SVG ByteArray to a Bitmap use toBitmap.

See also

toBitmap

Parameters

road

object representing current road

userId

Mapbox user account name

styleId

style id used to render the map

accessToken

public access token

callback

invoked with appropriate result