cameraForCoordinates

open override fun cameraForCoordinates(coordinates: List<Point>, coordinatesPadding: EdgeInsets?, bearing: Double?, pitch: Double?): CameraOptions

Convert the given list of coordinates, coordinatesPadding, bearing and pitch values to CameraOptions. Note that this method takes into account the current map padding in addition to the coordinatesPadding provided in parameters.

In order for this method to produce correct results MapView must be already measured and inflated to have correct width and height values. Calling this method in Activity.onCreate will lead to incorrect results.

Return

the converted CameraOptions. Padding is absent in the returned CameraOptions as the zoom level already accounts for the coordinatesPadding provided.

Parameters

coordinates

The List of coordinates to take in account when converting

coordinatesPadding

The amount of padding in pixels to add to the given coordinates.

bearing

The optional bearing to take in account when converting

pitch

The optional pitch to take in account when converting


open override fun cameraForCoordinates(coordinates: List<Point>, camera: CameraOptions, box: ScreenBox): CameraOptions

Convenience method that returns the camera options object for given arguments

In order for this method to produce correct results MapView must be already measured and inflated to have correct width and height values. Calling this method in Activity.onCreate will lead to incorrect results.

Returns the camera options object for given arguments with zoom adjusted to fit \p coordinates into \p box, so that coordinates on the left, top and right of \p camera.center fit into \p box. Returns the provided camera options object unchanged upon error.

This API isn't supported by Globe projection and will return a no-op result matching the current camera center. See com.mapbox.maps.extension.style.projection.generated.setProjection and com.mapbox.maps.extension.style.projection.generated.getProjection

Return

Returns the camera options object with the zoom level adjusted to fit \p coordinates into \p box.

Parameters

coordinates

The coordinates representing the bounds of the map

box

The box into which \p coordinates should fit

camera

The camera for which zoom should be adjusted. Note that \p camera.center is required.