mapbox / mapbox/mapbox-maps-android

setBounds move map to incorrect area

Open
#1,917 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :beetle:
Dominant language
Kotlin
Stars
578
Forks
161
PR merge metrics
No merged PRs in 30d

Description

## Environment

- Android OS version: Android 11
- Devices affected: Samsung Galaxy Tab A8
- Maps SDK Version: 10.8.1

## Observed behavior and steps to reproduce

when I set bounds for small region, the map is moved to the incorrect area. Example:

```
mapView = findViewById(R.id.mapView)
mapView?.getMapboxMap()?.loadStyleUri(Style.MAPBOX_STREETS)
mapView?.getMapboxMap()?.setBounds(
CameraBoundsOptions.Builder()
.bounds(CoordinateBounds(
Point.fromLngLat(30.000000010,70.455706592),
Point.fromLngLat(30.000000000,70.455706582)
))
.build()
)
mapView?.getMapboxMap()?.addOnMapClickListener {
println(mapView!!.getMapboxMap().cameraState.center) // here I get 210.000000005, 70.45567451371102
true
}
```

## Expected behavior

setBounds should move map to bounds center point

## Notes / preliminary analysis

## Additional links and references

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided Android reproduction on the Mapbox Maps SDK version and inspect the MapboxMap.setBounds entry point with its CameraBoundsOptions and CoordinateBounds inputs. Compare the reported camera center with the requested bounds center, and consider the issue done when the small-region example moves to the expected center without regressing normal bounds behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.