mapbox / mapbox/mapbox-maps-android
setBounds move map to incorrect area
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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